Game Development Community

Play Animation

by Thomas Bang · in Torque Game Engine · 10/08/2007 (3:41 am) · 2 replies

Hi

I want to play a animation of my dts-object. ShowToolPro shows me the correct animation.
Note: I dont have dsq-files.

Here is my code:

datablock StaticShapeData(MyDoor)
{
   category = "anim";
   shapeFile = "~/data/shapes/anim/mydoor.dts";
   className = "MyDoorClass";
};

function MyDoorClass::onAdd(%this)
{
   echo("Door added...");
   %this.playThread(0,"open_close");
}

The Console says:

Unknown command playThread.
Object MyDoor(10) MyDoor -> MyDoorClass -> StaticShapeData -> ShapeBaseData -> GameBaseData -> SimDataBlock -> SimObject

#1
10/08/2007 (3:53 am)
function MyDoorClass::onAdd(%this, %obj)
{
   echo("Door added...");
   %obj.playThread(0, "open_close");
}

The first parameter, %this, refers to the class name. You need to add a second parameter, I use %obj, to reference the actual object.
#2
10/08/2007 (4:00 am)
Ah, it works now. Very cool.

Thank you.