Game Development Community


#1
12/09/2010 (4:50 am)
It's what the headside animations are for (though I think in stock it's reversed oddly). Use them with the "vanity" key and set the camera limits in player.cs so you don't overextend the animations limit.
#2
12/09/2010 (2:45 pm)
do they actually work?

because in game, if you turn the mouse, well, you turn, not the head, but the whole body.

let me explain what I want to achieve; I want "stepped" turning.

"stepped" turning?? wtf??

if turning the mouse, first the head should turn till it reaches an 8th of a full turn, then the torso should start turning till a third of a full turn, then the whole body should turn.

seen it done ;o), no clue how to do it ;o(
#3
12/09/2010 (3:33 pm)
By default the head turning animation will only be used when you hold the freelook key and actually move the camera around in 3rd person I believe (or when holding freelook and looking around while mounted as the driver in a vehicle). I don't think there's any stock code to do what you want. Basically, when mouse input is being handled you want to rotate the head (and by that I mean mHead.z, not the actual model's head -- animation will take care of that) for the first X degrees and then start actually rotating the Player. Instead of making two distinct animations you'll just make the animation begin by only turning the head and eventually start moving the torso.

Then you need to make a choice about how movement will be handled. Basically, either the player always straightens out when you move (body turns to match up with head direction when you start running forward, resulting in the "normal" Torque turning behavior whenever the player is in motion) or the player's head and torso stay turned and the body is moved in the direction you're looking. To do the second, you'll want to use the player's z-rotation + mHead.z to get the run angle instead of just the player's forward vector. Just for reference, the Source engine uses the first method.

I should mention that, when holding a weapon, you probably want your model to just start rotating the torso from the beginning so the gun is aimed correctly, otherwise they'll be firing bullets out of the side of the gun. If the animation doesn't include firearms holding, the head first torso second thing makes more sense.
#4
12/09/2010 (5:43 pm)
thanks Henry,

I have default freelook in vehicles, all controls are keyboard, and the head doesnt turn, only the cam.
and the aiming is no problem, I have a aim state called before firing anyway, that deals with shooting.

I think your description will get me what I need.
lets see.....
#5
12/09/2010 (9:40 pm)
It's been a while since I was deep into the vehicle code, but I don't think the headside animation gets used when mounted to a vehicle. The stock code just sets the animation to the sitting pose and that's it.
#6
12/09/2010 (10:11 pm)
yes, I see so, I've started dragging a lot over from player into vehicle to get the extra functionality,
slowly making some leeway.