turn head with camera?
by deepscratch · in Torque 3D Professional · 12/09/2010 (2:30 am) · 6 replies
hi all,
so how can I get the players head to actualy turn and follow where the camera points?
really stuck on this one ;o(
so how can I get the players head to actualy turn and follow where the camera points?
really stuck on this one ;o(
About the author
email me at medan121@gmail.com
Recent Threads
#2
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(
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
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.
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
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.....
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
slowly making some leeway.
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.
Associate Steve Acaster
[YorkshireRifles.com]