Forum

Player shoot and run animations

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Player shoot and run animations

Postby Max_Salivan » Mon Mar 30, 2015 8:57 am

Hello everyone.
I have a dpm model and i want to control bones without csqc,is there a way to do it?
I tried split model on legs and tors parts and use MOVETYPE_FOLLOW,but its looks bad.

:lol:
http://www.youtube.com/watch?v=q1ldKNgr ... e=youtu.be
Sorry for my english :)
Max_Salivan
 
Posts: 89
Joined: Thu Dec 15, 2011 1:00 pm

Re: Player shoot and run animations

Postby jjsullivan5196 » Mon Jun 08, 2015 5:38 am

Yeah, unfortunately skeletal objects can only be directly controlled with CSQC, sorry.

However, you can make your little trick there look a little neater with setattachment(); it will attach the other half of your model clientside, so everything matches up correctly.

Just some quick pseudocode:

Code: Select all
entity tophalf = spawn();
entity lowerhalf = spawn();

//We'll attach tophalf to lowerhalf
setmodel(lowerhalf, "models/bottom.iqm");
setmodel(tophalf, "models/top.iqm");

setattachment(tophalf, lowerhalf, "lower_attachment"); // Arguments are as follows: 1. The entity you want to attach, 2. The entity to attach onto, 3. The name of the tag or bone to attach onto (Set in your 3d modeling package)


I'm sure you're just dicking around with the player entity, so just swap out lowerhalf for the player. Of course set size and everything else as usual. Just note that size, angles, and origin will be relative to the tag/bone you attach to, so make sure all transforms are applied to your models or weird shit will happen.

If you just want to do some simple stuff and blend the animations with some really simple rotation control, this is okay. However, it's not actually too hard to set up .basebone to do similar stuff in CSQC. I won't say skeletal objects are the easiest thing in the world, but they do offer you the most control out of all of these options.
jjsullivan5196
 
Posts: 21
Joined: Sun Apr 21, 2013 10:50 pm

Re: Player shoot and run animations

Postby Max_Salivan » Mon Jun 08, 2015 6:15 am

Thanks for reply.
At this moment i am using dpm(converted half life model in to dpm).
I could not find info about tags(how to do it or something else).

i didnt know what 3 argument of setattachment can be bone name. Maybe i can get better player model with setattachment function.
Sorry for my english :)
Max_Salivan
 
Posts: 89
Joined: Thu Dec 15, 2011 1:00 pm

Re: Player shoot and run animations

Postby jjsullivan5196 » Mon Jun 08, 2015 6:24 am

Max_Salivan wrote:Thanks for reply.
At this moment i am using dpm(converted half life model in to dpm).
I could not find info about tags(how to do it or something else).

i didnt know what 3 argument of setattachment can be bone name. Maybe i can get better player model with setattachment function.


Tags/bone names are essentially the same chunk of data, so you can use the bone name to use setattachment(); Just make sure you take note of how you set up your skeletons and where you want to attach things.
jjsullivan5196
 
Posts: 21
Joined: Sun Apr 21, 2013 10:50 pm

Re: Player shoot and run animations

Postby Max_Salivan » Mon Jun 08, 2015 6:34 am

Ok,bigthanks, i'll try it.
Is there a way to see dpm bones?(program or something else). DPMViewer cant do it(
Sorry for my english :)
Max_Salivan
 
Posts: 89
Joined: Thu Dec 15, 2011 1:00 pm

Re: Player shoot and run animations

Postby jjsullivan5196 » Mon Jun 08, 2015 6:50 am

Max_Salivan wrote:Ok,bigthanks, i'll try it.
Is there a way to see dpm bones?(program or something else). DPMViewer cant do it(


That's a toughie, as I don't use dpm.

What modeling package do you use to edit your model? Are you just using standard hl2 models? I think noesis might be able to figure out the bone names for you, but don't quote me on that.

http://www.richwhitehouse.com/index.php ... ojects.php

When it comes down to it, it depends on what you named the bones in your modeling tool, or what your smd compiler says they are.
jjsullivan5196
 
Posts: 21
Joined: Sun Apr 21, 2013 10:50 pm

Re: Player shoot and run animations

Postby Max_Salivan » Mon Jun 08, 2015 7:28 am

I found bone names in milkshape)
And wrote something like this,but animation are still like a shit(like this lol http://www.youtube.com/watch?v=-y93lpCP ... e=youtu.be)

Code: Select all
void() all_update =
{
    if (self.owner.velocity_x || self.owner.velocity_y)   
      self.frame = 1;
   else   
      self.frame = 0;
   self.angles_y = self.owner.angles_y;
   self.origin = self.owner.origin;
   self.think = all_update;
   self.nextthink = time + 0.01;
}
void() DrawAll =
{
   tophalf = spawn();
   lowerhalf = spawn();
   setmodel(lowerhalf, "progs/player_legs.dpm");
   setmodel(tophalf, "progs/player_tors.dpm");
   lowerhalf.owner = self ;
   setattachment(tophalf, lowerhalf, "Bip01");
   lowerhalf.think = all_update;
   lowerhalf.nextthink = time + 0.01;
}
Sorry for my english :)
Max_Salivan
 
Posts: 89
Joined: Thu Dec 15, 2011 1:00 pm

Re: Player shoot and run animations

Postby jjsullivan5196 » Wed Jun 10, 2015 7:56 am

Max_Salivan wrote:I found bone names in milkshape)
And wrote something like this,but animation are still like a shit(like this lol http://www.youtube.com/watch?v=-y93lpCP ... e=youtu.be)

Code: Select all
void() all_update =
{
    if (self.owner.velocity_x || self.owner.velocity_y)   
      self.frame = 1;
   else   
      self.frame = 0;
   self.angles_y = self.owner.angles_y;
   self.origin = self.owner.origin;
   self.think = all_update;
   self.nextthink = time + 0.01;
}
void() DrawAll =
{
   tophalf = spawn();
   lowerhalf = spawn();
   setmodel(lowerhalf, "progs/player_legs.dpm");
   setmodel(tophalf, "progs/player_tors.dpm");
   lowerhalf.owner = self ;
   setattachment(tophalf, lowerhalf, "Bip01");
   lowerhalf.think = all_update;
   lowerhalf.nextthink = time + 0.01;
}


I'm not sure if that's just pseudocode, but it seems like the inheritance of origins is a bit inverted in your example. It seems like the parent(legs) are getting updated with it's own origin, rather than updating the origin of the torso in relation to the legs.

Remember, setattachment(); will set origin, size, and angles in relation to the bone the entity was attached to. So where that bone goes, the attached entity goes. So setting origin isn't absolute in world space when we're talking about the attached entity. If torso.origin is '0 0 12' that means the torso will be moved 12 units up from the bone that attaches it to the legs. So if you use gettaginfo(); to find the origin of the attachment point, say ' 22 5 50' then the torso will be at '22 5 62' ('0 0 12' + '22 5 50').

Depending on your engine, there will be some glitches when it comes to network prediction and physics. Spoike has said in FTE, setattachment(); is applied clientside, so usually there will be no problems. However, since you use DarkPlaces, that might be a different story. Check the DP docs for any cvars that control player physics and network behavior to see if you can get something a bit better looking, and if that doesn't work, check your models in milkshape and make sure that all the bone positions/sizes are correct.
jjsullivan5196
 
Posts: 21
Joined: Sun Apr 21, 2013 10:50 pm

Re: Player shoot and run animations

Postby Spike » Wed Jun 10, 2015 9:26 am

both engines do the attachment clientside. afaik neither emulates it even when the network protocol doesn't support it.
as jjsullivan5196 says, attachments change angles too based upon the attached bone's origin. this is somewhat vital for things like guns following the player's hand, but it does mean that you need to pay explicit attention to the orientation of the bones. The easiest way is to insert an explicit attachment bone (aka: tag) to your legs model at the same position as the current waist bone, but with an explicit+constant upright angle (with the legs geometry following the existing bone).
Alternatively you can attach your torso to the null bone (ie: "" instead of "Bip01"), however this will prevent your torso from moving up and down as the legs crouch and bob while walking.

death animations (where the torso tilts over by 90 degrees) are an awkward special case. presumably this is already an added complication.
Spike
 
Posts: 2878
Joined: Fri Nov 05, 2004 3:12 am
Location: UK


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest