Game Development Community

How to show Morph Animation in the game...?

by Chan Chi Kit · in Torque Game Engine · 12/12/2005 (6:44 pm) · 3 replies

I am going to create a flag with animation and then mount it to my player in the game.

I am using Geometric/Deformable to create a wave surface in 3DS Max8 to move the vertex. Then, I export the flag to DTS (Not DSQ) with sequence by morph animation. I can play the sequence in ShowTool, however, when I insert the flag to the game engine, it do not have sequence...

Is this necessary to make morph animation by MilkShape, not 3DS Max...?

Any thing wrong to my model...?

Thanks!

#1
12/13/2005 (6:39 am)
You actually have a programming problem.

First you need to determine what kind of object the flag will be, an Item, a StaticShape ( probably ).

Second, create a script called StaticShape.CS and place it in the server/scripts directory.

It's content should be :
function StaticShapeData::create(%data)
{
   // The mission editor invokes this method when it wants to create
   // an object of the given datablock type.
   %obj = new StaticShape() {
      dataBlock = %data;
   };
   return %obj;
}

May be you already have this script. Just make sure it's executed.

Then, after placing your flag in the game, you may activate the sequence using :

%obj.PlayThread(0,"sequence name enters here");

You may also put this code snippet in the creation part so whenever the flag is created, it will run the sequence, but it will also trigger the animation for all StaticShapes created, so you should check what kind of static shape you are creating previous to activating the animation.

HTH
#2
12/13/2005 (7:43 am)
Now, in schematic of my model, it have a box of pole and a box of flag (this is surface only), they are not connected together but are connected to "Start01" separately. The box of "Wave01" was to animate the movement of flag surface and did not connect to anything.

I knew how to activate the sequence/animation in the game by the command/script, but I don't understand why when I change the mount image to the flagpole.dts which come with game engine, it will show the animation sequence, I did not change anything in the script except the file name of mount image...

Thanks!
#3
12/14/2005 (1:46 am)
I understood why the sequence/animation in flagpole.dts can be played automatically in the game. It is because of sequence name, if I changed the sequence name to "ambient", then my object's sequence can also be played in the game automatically, no need to add commend or change anything in the script...

Thanks!