Game Development Community

Static Shape animation problem

by Varma Dandu@longsword · in Artist Corner · 12/20/2008 (4:46 am) · 3 replies

Hi all,

I follow simpleShapeAnimation tutorial located at Garagegames website

I am using Maya for creating models and I download the maya2dts file pack and open simpleShapeAnimation.mb file and I follow the entire tutorial

finally got animation, that animation plays in toque show tool but it not plays in toque engine

I put the model form staticShapes folder of TGE, but I know static shape that contains animation does not require any scripting ?

How can I solve my problem?

Please help me.

Thanks.

#1
12/20/2008 (7:08 am)
Animated shapes are statics. They require scripting. Fortunately, it's a simple call in the script.

//---------------------------------------------------------------------------------------//
// Taken from the ifl example in tge1.5.2/starter.fps/server/scripts/ifl.cs                                                                                      //
//                                                                                       //
// This script sets up your animations.                                           //
// sets it up so that when the object is placed in the world (or ::onadd)                //
// the animations are played.                                                     //
//                                                                                       //
//                  *******Current list of items *******                       //
//                                                                                       //
//---------------------------------------------------------------------------------------//
 

datablock StaticShapeData(example) //We name our static something we will remember
{
	// The category variable determines where the item
	// shows up in the mission editor's creator tree.

	category = "Misc"; // You can name this something else that fits your shape is you prefer. I usually leave all my shapes in this simgroup.
	shapeFile = "~/data/shapes/myShapeFolder/myShape.dts"; //Location of the .DTS
};

function example::onAdd(%this,%obj) //What do we want to do with our new shape??
{
	%obj.playthread(0, "myAmimation");  // We tell torque to play our animation using "playThread"
	                                     // It will be the only animation so we put 0, then the name
	                                     // we gave our animation. ( #1 in our example image)
}
// We need to create our static shape
function StaticShapeData::create(%block)
{

	%obj = new StaticShape()
	{
		dataBlock = %block;
	};
	return(%obj);
}
// and we are almost done. Copy your shape folder to "data/shapes" then, 
// We have to add "exec("./exampleAnimation.cs"); to server/scripts/game.cs and place our exampleAnimation.cs in the same 
// folder. Once this is done, we go into torque.

Hope this helps you.
#2
12/21/2008 (5:37 am)
Thank you very much! Mike, I got the answer.

I like your explanation its awesome.

And I also thank to Garagegames for establish this good forum.

once again Thank you very much!



enjoy!!!
#3
12/21/2008 (6:10 am)
You are welcome. Have fun.