Game Development Community

Playing animation in-game

by wingman · in Artist Corner · 08/10/2003 (1:25 pm) · 5 replies

Can someone point me to a tutorial on this?

I need an animation to play on my model when a player touches the object.

The model is a test model with a 30 frame animation. Im testing this in Realm Wars.

#1
08/10/2003 (3:04 pm)
Animation sequences and naming them in Milkshape:
www.garagegames.com/docs/torque.sdk/tools/milkshape.html#animation

Just put that playThread function in the oncollision function of your object... I'm sure there are some examples of onCollision functions in item.cs or health.cs (or something like that)
#2
08/10/2003 (4:56 pm)
Thanks alot for that tutorial. it helped me set up milkshape animations properly.

still having a problem with getting the animation to play in-game.
#3
08/12/2003 (1:17 am)
I'm only learning animations myself, so give me a few days and I'll see if I can get it to work.

I'll post status
#4
08/12/2003 (2:23 am)
Hi,

Make a file called myModel.cs or something then add the following in that file:
datablock StaticShapeData(myModel)
{
   category = "Misc";
   shapeFile = "~/data/shapes/mymodel/mymodelname.dts";
};

function myModel::onAdd(%this,%obj)
{
   %obj.playThread(0,"rotate"); //or nothing incase it doesn't have to play a certain animation right from the start
}   

function StaticShapeData::create(%block)
{
   %obj = new StaticShape()
   {
      dataBlock = %block;
   };
   return(%obj);
}

function myModel::onCollision(%this,%obj,%col)
{
  %obj.PlayThread(0, "gogo");
}
In game.cs add:
exec("myModel.cs"); //put this where the other exec calls are...
Now add the shape to the mission by getting it from the shapes drop down list (not the static shapes one)... it should be under misc.

I wrote this code assuming your playthread function is correct... I didn't really use that before... so i'm not sure its syntax is correct. The rest of the code was also written of the top of my head, so its possible this isn't working, but you get the idea.
#5
08/15/2003 (2:29 pm)
And what was it?