Character inside wheeled vehicle - steering animation.
by The Guv · in Torque 3D Professional · 10/18/2011 (1:38 pm) · 4 replies
Hi All,
I've successfully rigged up a wheeled vehicle and replaced the cheetah model, also have a character mounting in the correct position. I've also rigged and animated this separate character (biped) to move with a couple of handlebars similar to what you'd see inside a tank. It's the default T3D character rig.
My question is, how do you get the characters steering animation to play at the same time as the vehicles steering animation? So when the wheels turn I'd like the character to look like he's making it happen, the same as a steerign wheel etc. ? I'm assuming you can't include the character in the vehicle rigged as a biped, I'm assuming he needs to be mounted to a node etc.
I'm an artist by the way, but have quite a bit of torque scripting experience, BUT am not a programmer ...
Thanks, really hope someone can clear this up for me 8)
I've successfully rigged up a wheeled vehicle and replaced the cheetah model, also have a character mounting in the correct position. I've also rigged and animated this separate character (biped) to move with a couple of handlebars similar to what you'd see inside a tank. It's the default T3D character rig.
My question is, how do you get the characters steering animation to play at the same time as the vehicles steering animation? So when the wheels turn I'd like the character to look like he's making it happen, the same as a steerign wheel etc. ? I'm assuming you can't include the character in the vehicle rigged as a biped, I'm assuming he needs to be mounted to a node etc.
I'm an artist by the way, but have quite a bit of torque scripting experience, BUT am not a programmer ...
Thanks, really hope someone can clear this up for me 8)
#2
Now, I think you could hack a few ways to get the player animated. They would require a custom object be mounted instead of the player object as it will require custom animations. You could create a damage thread where the fake player is turning left when damage/health is below a certain level and turn more as the health is lower. The center would be median health. And right could be higher health. Just make sure you don't kill your fake player by allowing health to go below zero. Also you can't let the fake player take damage. That is a limitation.
Another method would be to have a custom animation that is coupled to the player looking left or right. Then you could do a head animation for turning in addition to the left right movement. Then you could pass control information to the fake player.
I believe all of this could be done without C++ coding. It requires a little bit of sneakyness, but I believe it is doable.
Anyone else have any sneaky ideas?
01/10/2012 (10:08 pm)
I looked through the vehicle code and it looks like it might be a pain to expose the steering input the vehicle gets to script. There are scaling factors and other such things that would complicate it. So I would look at the input that is used to control the vehicle. Namely the mouse input or joystick input that is setup in the actionmap. Now, I think you could hack a few ways to get the player animated. They would require a custom object be mounted instead of the player object as it will require custom animations. You could create a damage thread where the fake player is turning left when damage/health is below a certain level and turn more as the health is lower. The center would be median health. And right could be higher health. Just make sure you don't kill your fake player by allowing health to go below zero. Also you can't let the fake player take damage. That is a limitation.
Another method would be to have a custom animation that is coupled to the player looking left or right. Then you could do a head animation for turning in addition to the left right movement. Then you could pass control information to the fake player.
I believe all of this could be done without C++ coding. It requires a little bit of sneakyness, but I believe it is doable.
Anyone else have any sneaky ideas?
#3
01/17/2012 (3:18 pm)
Sorry, I changed this to WITHOUT C++ coding. I realized I said it wrong.
#4
Related to this, Vehicle has a member called mSteering which seems to store the last steering angle of the vehicle. You'd need to add a method to get it since it's protected.
01/20/2012 (8:21 am)
I reckon it shouldn't be too difficult to modify the source in this regard. This code in player.cpp is responsible for controlling what move data gets sent where when the Player is controlling another object:// Manage the control object and filter moves for the player
Move pMove,cMove;
if (mControlObject) {
if (!move)
mControlObject->processTick(0);
else {
pMove = NullMove;
cMove = *move;
//if (isMounted()) {
// Filter Jump trigger if mounted
//pMove.trigger[2] = move->trigger[2];
//cMove.trigger[2] = false;
//}
if (move->freeLook) {
// Filter yaw/picth/roll when freelooking.
pMove.yaw = move->yaw;
pMove.pitch = move->pitch;
pMove.roll = move->roll;
pMove.freeLook = true;
cMove.freeLook = false;
cMove.yaw = cMove.pitch = cMove.roll = 0.0f;
}
mControlObject->processTick((mDamageState == Enabled)? &cMove: &NullMove);
move = &pMove;
}
}It looks like it would be a small change to actually send parts of the original move to the Player (pMove) as well as the vehicle, like the way pitch and yaw are passed on when freelooking. You could even directly set the player's animation position there.Related to this, Vehicle has a member called mSteering which seems to store the last steering angle of the vehicle. You'd need to add a method to get it since it's protected.
Ahsan Muzaheed
Default Studio Name
suppose u already have wheel animation that plays when u press button for left movement.
now set a trigger in wheel's left animation
also set a trigger in character's animation that u want to play during wheel's left animation.
now write script to play that animation during wheel's left animation.
may be something like function onTrigger(){} will work.
(not sure)
may be deepscratch can help,in his youtube video it seems he already have done that.