Game Development Community

Getting Animations to work - I can't..

by Michael Sprindzuikate · in Artist Corner · 02/08/2006 (5:07 am) · 10 replies

Hello everyone!

First off, I have done a thorough search of the forums on getting an animated .dts object to work in Torque: everything from .dsq files, TSShape, ItemData, playThread(), SetAnimationThread(), and loads of other things, but I just cannot seem to get it to work. And I'm getting to the point where I'm ready to call it a day and move on to something else...like pottery!

So, would anyone be able to kinda hold my hand through a really simple way of getting a .dts animation to work? I am really pulling my hair out over this.


Thanks in advance,
Michael

About the author

Recent Threads


#1
02/08/2006 (9:34 am)
It would be easier if you informed us what modeling application and exporter you are using...err trying to use. I'm using milkshape dtsexporterplus.
#2
02/08/2006 (4:05 pm)
I'm using 3D Studio Max 6 and dts exporter. I really appreciate any help at all :)
#3
02/09/2006 (3:04 am)
Michael,

can you post the file hierarchy and the script used to set up your animation in TGE ?

Christophe
#4
02/09/2006 (5:04 am)
1. Have bounds box around anything you need exported...
2. Have bone chain be one single hierarchy (this can involve making a unneccessary bone to add all bone chains to purely for the sake of exporting).
3.Rigged Mesh is contained in the .dts file .. animations in .dsq files ..but add a dts sequence dummy to the dts and keyframe between 0-1... i normally call mine root...
4.Each mesh must have a detail marker and vice versa (Multires creates the meshes on export).
5.The pivot of the mesh must be facing the same way as the pivot in the bottom left of each max viewport before you rig it for proper alignment... (means it face right way,not essential, but advisable)


besides that.. post your hierarchy.. its generally a big help...
#5
02/09/2006 (5:19 am)
Cheers for that, I have my animation working in ShowTool, but am completely stumped when it comes to importing it into the engine.

I know I have to create a datablock for the object and put it in the "static" category, but from there anything else I try doesn't work. Do I need to use the StaticShapeData(), ItemData() or TSShape() datablocks? Does playThread() only apply to specific datablocks?
#6
02/09/2006 (7:24 am)
Try this script :


datablock StaticShapeData(MyObject)

   {
      category = "MyCategory";
      shapeFile = "~/data/shapes/MyObject.dts";
   };
         
function MyObject::onAdd(%this,%obj)
   {
           %obj.playThread(0,"MyAnimation");
   }


Christophe
#7
02/13/2006 (10:33 am)
Sorry I haven't replied but I've been v. busy! Thanks for all the help, finally got the animation to work - I just had to delete the whole .cs file I was working in and start from scratch, too many bodged attempts left me in a muddle!

Thanks again to everyone for all the help!
#8
02/21/2006 (9:36 am)
Hiya..I've been struggling with the same problem..here goes:

I've exported my .dts and .dsq file from maya and everything looks and animates perfectly in ShowTool. Here's a peek at my maya outliner:

img314.imageshack.us/img314/6044/untitled10lh.jpg
I then copied the .dts, .dsq and textures to C:\Torque\SDK\example\starter.fps\data\shapes\windmill.

Next I created windmill.cs:

datablock StaticShapeData(MyObject)

   {
      category = "MyCategory";
      shapeFile = "~/data/shapes/windmill/windmill.dts";
   };
         
function MyObject::onAdd(%this,%obj)
   {
           %obj.playThread(0,"anim0");
   }

This file I placed in C:\Torque\SDK\example\starter.fps\server\scripts.

Finally I edited game.cs (inside the server directory) and added this near the top:

exec("./windmill.cs");

But no in-game animations :( Is there any thing I need to do in the editor besides adding the object?

THANKS!
#9
02/21/2006 (12:57 pm)
You're probably just adding the tsstatic version of the model.(i think thats what its called)

you've successfully completed the template for the object, but you still need to instantiate it in the game.

in game.cs, in the function onClientEnterGame() add this:

new staticshape(myshape)
{
   datablock=myobject;   //set datablock
   position="10 10 10";   //set location
};

after the call to new the object will be introduced into the game and onAdd() will be called.

you can use the in-game editor to add the object. you just need to look for your "mycategory" directory. let us know if this works.
#10
02/21/2006 (1:19 pm)
Quote:you can use the in-game editor to add the object. you just need to look for your "mycategory" directory. let us know if this works.

AHA! I was adding the wrong object in the editor. Thank you! Tested &working!