Game Development Community

Adding movements in T3D

by Luis Fernando de Leon · in Torque 3D Public · 11/06/2009 (2:15 pm) · 2 replies

We just started developing in T3D and are stuck with a problem. We want to add new independent movements to our main character, but we have not found any documentation in how to this. For example we have notice that when you press the left or right button it triggers the side movement. But what we want is to make left and right two independent movements so that T3D knows that every time that the player presses left the left animation is shown and when the player presses right the right animation is shown. How do we do this?

I have check a few post but there no concreate information on how to do this in T3D. The only one that comes really close is this one:
http://www.garagegames.com/community/resources/view/2611

But it there is a part with the code that doesn't exist any more in the .cc file so we can't use that, so any of you knows of another source that might help us. Again any help would be really usefull, we are c++ experience programers, but are IT (Idiots in Torque)so there are still some concepts that we don't master.

#1
11/06/2009 (9:36 pm)
You need source access to do this, just posted this in private forums.

Lets Pickon The G Man
//-----------------------------------------------------------------------------
// Updated Gideon Model done in 3DS Max with Stock Torque Animations
//-----------------------------------------------------------------------------

singleton TSShapeConstructor(GideonReduxDts)
{
   baseShape = "./gideon.dts";
   sequence0 = "./player_root.dsq root";
...
   sequence3 = "./player_dieleftleg.dsq sideL";//OD CHANGE
...
   sequence45 = "./player_dierightleg.dsq sideR";//OD CHANGE
};

C++ Time!
RootAnim,
      RunForwardAnim,
      BackBackwardAnim,
      SideLeftAnim,
      SideRightAnim, //OD CHANGE

      CrouchRootAnim,
      CrouchForwardAnim,
      ProneRootAnim,
      ProneForwardAnim,
      SwimRootAnim,
      SwimForwardAnim,
      SwimBackwardAnim,
      SwimLeftAnim,
      SwimRightAnim,
      
      // These are set explicitly based on player actions
      FallAnim,
      JumpAnim,
      StandJumpAnim,
      LandAnim,
      JetAnim,
      
      // 
      NumMoveActionAnims = SideRightAnim + 1, //OD CHANGE
      NumTableActionAnims = JetAnim + 1,

      NumExtraActionAnims = 512 - NumTableActionAnims,
      NumActionAnims = NumTableActionAnims + NumExtraActionAnims,
      ActionAnimBits = 9,
      NullAnimation = (1 << ActionAnimBits) - 1

// Action Animations:

   // Root is the default animation
   { "root" },       // RootAnim,

   // These are selected in the move state based on velocity
   { "run",  { 0.0f, 1.0f, 0.0f } },       // RunForwardAnim,
   { "back", { 0.0f, -1.0f, 0.0f } },       // BackBackwardAnim
   { "sideL", { -1.0f, 0.0f, 0.0f } },       // SideLeftAnim,//OD CHANGE
   { "sideR", { 1.0f, 0.0f, 0.0f } },       // SideRightAnim,//OD CHANGE

Now lets remove the Right-> Special case
//OD CHANGE
      /*
      else
               {
                  // Special case, re-use slide left animation to slide right
                  if (i == PlayerData::SideLeftAnim && -d > curMax)
                  {
                     curMax = -d;
                     action = i;
                     forward = false;
                  }
               }
      */

And a Video or it aint so!



Cheers!
#2
11/07/2009 (12:43 pm)
Great tip! I only have a few questions. When I do any changes to the engine's core *.h and *.cpp files do I need to rebuild the entire T3D project? Like in this case after changing player.cpp and player.h do I need to open the T3D project in VS and rebuild? And how do I do this? Please help, Im IT too since this is the first project that Im developing in Torque.