Game Development Community

Newbie Question Playing animation

by Michael Dockery · in Artist Corner · 05/02/2007 (6:46 pm) · 8 replies

First ive searched for this perticular question but its probably so obvious that nobaodies asked before. Anyway i have a test model basic shape from milkshape that has an animation called testing that appears and plays in the show tool. When i try to play it in the demo engine ie(0000.playthread(...,0000.setactionthread(...) i get unknown command...etc. I have exported both as embedded and as dqs with .cs file but im really unsure as to how to implement the animation or how to get my test model to be a shape as opposed to a static one. Any help would be great or as im just doing this as a learning curve a tutorial would be even better. thanks

#1
05/03/2007 (4:17 am)
Just so you dont think im being lazy and not looking for answers myself i did search and even bought Mr Finneys book but i cant get it to work. I have a few more questions.

1:Do i have to just the (root,run,die1...) naming conventions for the animations?
2:Why do all my object appear in the static shape list regardless of embedded animation?
3:Why does the Orc model only appear in the static list, I also cant get him to animate except from the original model that is loaded into the demo on startup but not any one that i place in?

Surley making a model animating it and exporting under correct DTS proceedure should be enough for the engine to recognise that it is going to be used as an animated model. This is really frustrating me i could really do with a few pointers.
#2
05/03/2007 (7:39 am)
How are you using setActionThread?
Use:
objName.setActionThread("animName");
To use this you need to have your animation defined in your players script. Look in your "data/shapes/player/player.cs" file for this line.
sequence29 = "./player_looknw.dsq looknw";
Using that you can create new animations.
sequence30 = "./player_testing.dsq testing";
Then use "yourPlayerName.setActionThread("testing");
#3
05/03/2007 (7:52 am)
Ive been creating an embedded dts file with 30frame anim called testing. Plays fine in the show tool and i can see the testing thread there. When i load this object into the engine via the demo 'World creator" i.e. non script based, i get a tsstatic object. I try to envoke the animation from the command console via setActionThread but get that 'Unknown command' error presumably because the object is loading as a tsstatic shape i think?
Im getting the feeling there is more scripting to declare this object as a non static one, maybe something to do with datablocks?
Ive tried to basically copy a paste the SpaceOrc player.cs into my own changing the details as above but still nothing do i have to exec the cs file?
#4
05/03/2007 (9:13 am)
I went back again created another simple model (3 boxes in a row with few joints) called it AAA and exported it using the DTS plus exporter which creates the .cs and dsq for you.

I have this in the cs file (aaa.cs)

datablock TSShapeConstructor(AaaDts)
{
baseShape = "./aaa.dts";
sequence0 = "./aaa_test.dsq test";
};

and i have aaa_test.dsq in the folder aswell.

I test this in my TEGA_DEBUG.exe -show, and it plays fine on a loop and i can see the thread test named there.

In the Player.cs in the server/scripts folder i added the line

Exec("/demo/data/shapes/AAA/aaa.cs");

which is right under the similar line for the player.cs for the space_orc.
I run the TEGA and in the demo mission i goto the World Editor Creator and under StaticShapes/AAA/
i add in my aaa.dts model which is motionless.
I fire up the command console and check for loading errors but find none. I then type:

aaa.setactionthread("test");
but i get the error "Unknown command setActionThread...."

I then assign an internalname (Bob) to the object and try again.
bob.setactionthread("test");
Same error!

I Try it with the handle i see on the object 1952.
but again the same error.

All the tutorials on animation seem to gloss over the actual 'getting it to work in the engine' bit. I cant see it can be anymore complicated than this.
#5
05/03/2007 (9:48 am)
Then there should only one thing left for you to do, create a datablock that can play animations:
datablock StaticShapeData(AAA)
{
   category = "Misc";
   shapeFile = "~/data/shapes/AAA/aaa.dts";
};

function AAA::onAdd(%this,%obj)
{
   %obj.playThread(0,"test");
}
#6
05/03/2007 (9:52 am)
Where should i put that code Caleb?
#7
05/03/2007 (10:01 am)
I put it in the aaa.cs and it worked great!

thanks for putting the time to look at this Caleb you have really helped me out.

So i take it in theory i can make these models as per above and have them activate their animation by trigger or user input with the playthread command or one similar?
#8
05/03/2007 (11:50 am)
You should be able to do that no problem.

Glad I could help.