Game Development Community

How to switch the pose of actor mounted on an wheelevehicle?

by Ji Xinyu · in Torque 3D Professional · 11/17/2012 (6:47 am) · 4 replies

I want to implement trolley with wheeledvehicle class.And I want the trolley and actor has the following attributes:
(1)The actor is in standing pose when the trolley stops.
(2)The actor is in walking pose when the trolley moves.
That is the pose of actor mounted on a trolley switch between standing and walking when the trolley stop and moves.anyone can give me some suggestion.Thank you.

#1
11/18/2012 (12:32 pm)
You'll probably have to modify the code to make this work nicely. If you have a look at the start of Player::pickActionAnimation, you'll see:
void Player::pickActionAnimation()
{
   // Only select animations in our normal move state.
   if (mState != MoveState || mDamageState != Enabled)
      return;

   if (isMounted() || mMountPending)
   {
      // Go into root position unless something was set explicitly
      // from a script.
      if (mActionAnimation.action != PlayerData::RootAnim &&
          mActionAnimation.action < PlayerData::NumTableActionAnims)
         setActionThread(PlayerData::RootAnim,true,false,false);
      return;
   }
So if you're mounted, you can set an animation using %player.setActionThread. However, you'd need to change this whenever your trolley stopped and started moving.

Alternatively, you could edit out this part of the code, as well as changing some other stuff relating to mounting, so that your character tries to animate as normal while mounted. Not pretty, but it would work eventually.
#2
11/18/2012 (9:10 pm)
Hi Daniel,thanks for your reply.I tried to set an "run" animation for actor mounted on a car using %player.setActionThread("run"); but the actor still sit on the car.It seems that we can not play actor's "run" animation when the actor mounted on a car
#3
11/18/2012 (11:15 pm)
Yes, sorry - that's because of the second clause in the if statement:
mActionAnimation.action < PlayerData::NumTableActionAnims
This basically stops the Player from running actions that are part of the standard set it uses automatically for moving. If you added the same animation again with a different name you should be able to play it, I think.
#4
11/19/2012 (12:19 am)
Hi Daniel,I have implement the functionality by modify the sequenceN and the name of "player_forward.dsq" in TSShapeConstructor.Thanks very much.