Animated objects not working. What am I missing.
by Gary Willhight · in Torque Game Engine · 04/10/2008 (10:24 am) · 5 replies
I am just getting started with TGE and am trying to add some simple static animation to my game. I found many examples and tutorials, followed them to the letter and still nothing. I place the object in the world and still no animation. I even went so far as using the flagpole from the demo and copying the code... nothing (when I run the demo, the flag does work).
Here's what I have:
I have TGE 1.5.2 compiled with MS VS.net.
I build the object, a simple butterfly with flapping wings, in 3DS Max 8.
I exported the object and animation sequence using max2dts 1.3
I tested it in ShowToolPro 1.3 everything works fine.
I placed the object in the world. no problems there.
created the following CS file (Butterfly.cs):
datablock StaticShapeData(Butterfly)
{
category = "Misc";
shapeFile = "~/data/shapes/Butterfly.dts";
};
function Butterfly::onAdd(%this,%obj)
{
%obj.playThread(0,"root"); //root is the name of the animation sequence.
} // I also tried it naming the animation sequence hover.
// I tried with and without this function since the documentation said
// it was needed with older version of TGE SDK
function StaticShapeData::create(%block)
{
%obj = new StaticShape()
{
dataBlock = %block;
};
return(%obj);
}
I also added the following line to the game.cs file located in the game ./server directory:
exec("./butterfly.cs");
I deleted all of the .dso files.
When I load the game the object appears, but no animation.
The .dso files are created for all .cs files.
The console shows that they complies without any exceptions.
Based on all of the references I found, and tutorials I have followed, this should result in my butterfly staying in one place flapping it's wings.
What am I missing; where did I go wrong.
Any help would be appreciated.
Here's what I have:
I have TGE 1.5.2 compiled with MS VS.net.
I build the object, a simple butterfly with flapping wings, in 3DS Max 8.
I exported the object and animation sequence using max2dts 1.3
I tested it in ShowToolPro 1.3 everything works fine.
I placed the object in the world. no problems there.
created the following CS file (Butterfly.cs):
datablock StaticShapeData(Butterfly)
{
category = "Misc";
shapeFile = "~/data/shapes/Butterfly.dts";
};
function Butterfly::onAdd(%this,%obj)
{
%obj.playThread(0,"root"); //root is the name of the animation sequence.
} // I also tried it naming the animation sequence hover.
// I tried with and without this function since the documentation said
// it was needed with older version of TGE SDK
function StaticShapeData::create(%block)
{
%obj = new StaticShape()
{
dataBlock = %block;
};
return(%obj);
}
I also added the following line to the game.cs file located in the game ./server directory:
exec("./butterfly.cs");
I deleted all of the .dso files.
When I load the game the object appears, but no animation.
The .dso files are created for all .cs files.
The console shows that they complies without any exceptions.
Based on all of the references I found, and tutorials I have followed, this should result in my butterfly staying in one place flapping it's wings.
What am I missing; where did I go wrong.
Any help would be appreciated.
#2
04/10/2008 (2:38 pm)
I added it through static shapes. I tried adding it from shapes/misc but it didn't do anything. Meaning it didn't place the object.
#3
04/10/2008 (3:46 pm)
I added it through static shaped. I tried adding it from shapes/misc but it didn't do anything.
#4
04/10/2008 (5:12 pm)
Mike, thanks for the clue. I went back and looked at the console log when I tried to add the object from the shapes/misc location. it gave me the not GameBaseData error I read about several places. I changed the name of datablock from butterfly to butterflyflap to resolve the duplication and now it work.
#5
04/10/2008 (8:00 pm)
Glad you got it working. :-)
Torque Owner Mike Rowley
Mike Rowley
Did you look in "(F11) (F4) shapes/Misc" ?
Or did you click on staticShapes and add it from there?
The line: category = "Misc"; tells torque to put your butterfly in the shapes/Misc section of the editor.