Game Development Community

Triggering an animation on an object.

by 840LABS · in Torque 3D Professional · 05/12/2010 (12:23 pm) · 1 replies

Hello community,

Where can i find information about binding animation of a Tsstatic mesh to a key?

I created several animations of a skinned object in Maya. I exported these animations as Dae files. I imported these animations into Torque, and now I want to bind these animations to the keyboard.

Thanks,
Mike

#1
05/14/2010 (2:36 pm)
TSStatic shapes only allow playing the "ambient" sequence, and this is started automatically (and cannot be changed or stopped) if the 'playAmbient' field is set.

Instead, use a StaticShape object, as this exposes a script method called playThread that you can use to play any animation sequence you want. To control the animation playback using key inputs, you'll need the ID of the StaticShape object (you can get this from the object's onAdd method, or by giving the shape a unique name in the World Editor. eg.

function playAnim1(%val)
{
   if (%val)
      MyObject.playThread(0, "anim1");
}

function playAnim2(%val)
{
   if (%val)
      MyObject.playThread(0, "anim2");
}

moveMap.bind( keyboard, a, playAnim1 );
moveMap.bind( keyboard, b, playAnim2 );