Animating simple object and exporting as DTS + more questions..
by cr · in Artist Corner · 10/12/2007 (9:43 am) · 7 replies
Before anyone asks, yes, I did search for the similar 'questions' and yes, I did found plenty of solutions. The ones I looked at (too tired & sleepy at the moment from trying this for an hour or two I think) didn't make any sense or forwarded me to something like this. Suffice it to say, I'd rather ask it here and get some clear hints or tips on the subject (hopefully exporting a animated model doesn't look like re-writing the whole engine).
So what I want to do?
1) Export small animation (like grass swaying in the wind) with the model as DTS. I followed a tutorial and got the sequence and curves right but it still showed up all static inside the editor. I tried it again with a simple sphere object just to see if it has anything to do with the grass being made up for 10-12 different shapes (attached into one object) but nope, the problem was still there (if anyone wants I'll post the animation of this object as well).
2) Export weapons (with different parts animated.. like trigger, mag reloading animation, etc.). In Doom3 it was rigging the model with the player hands mesh, don't have a clue about Torque since I can't find any proper tutorial that isn't 5 years old.
Help? Thanks in advance.
EDIT: Probably asking too much but can anyone take the pain to post short tutorial here? I think I am going to post a small TDN tutorial later for simple shapes for starters.. for dummies (like me) of course.
So what I want to do?
1) Export small animation (like grass swaying in the wind) with the model as DTS. I followed a tutorial and got the sequence and curves right but it still showed up all static inside the editor. I tried it again with a simple sphere object just to see if it has anything to do with the grass being made up for 10-12 different shapes (attached into one object) but nope, the problem was still there (if anyone wants I'll post the animation of this object as well).
2) Export weapons (with different parts animated.. like trigger, mag reloading animation, etc.). In Doom3 it was rigging the model with the player hands mesh, don't have a clue about Torque since I can't find any proper tutorial that isn't 5 years old.
Help? Thanks in advance.
EDIT: Probably asking too much but can anyone take the pain to post short tutorial here? I think I am going to post a small TDN tutorial later for simple shapes for starters.. for dummies (like me) of course.
#2
Example:
Now when you open the editor you will notice a new folder under your shapes hierarchy named AnimatedObjects. When you drop your shape into the world the animation will play.
10/12/2007 (11:32 pm)
You need a simple datablock and onAdd method to trigger an animation on a DTS file.Example:
datablock StaticShapeData(swayingGrass)
{
category = "AnimatedObjects";
shapeFile = "~/data/shapes/grass.dts";
className = "MyFoliage";
};
function MyFoliage::onAdd(%this, %obj)
{
%obj.playThread(0, "grassSway");
}Now when you open the editor you will notice a new folder under your shapes hierarchy named AnimatedObjects. When you drop your shape into the world the animation will play.
#3
I tried adding another model (simple bouncing ball animation from max) with following changes:
.. and again the model shows up fine except for the missing animation. I think the problem is with the way I am exporting animated objects from max:
- Create a model (sphere) with simple (30 sec) bouncing animation.
- Create a sequence named 'bounce' and set the begin/end keys (30 sec) in the curve editor (for the Sequence II).
- Create bounds for the sphere using DTS export utility (without bounds my export always crashes max).
- Using DTS Export Utility first Embed Shape and then export the object for the game.
Something is screwed up with my method here.. prob everything? :(
10/13/2007 (12:28 am)
Well, the model shows up fine but still without animation.I tried adding another model (simple bouncing ball animation from max) with following changes:
datablock StaticShapeData(bouncingBall)
{
category = "AnimatedObjects";
shapeFile = "~/data/shapes/test/ball_a01.dts";
className = "Ball";
};
function Ball::onAdd(%this, %obj)
{
%obj.playThread(0, "ballBounce");
}.. and again the model shows up fine except for the missing animation. I think the problem is with the way I am exporting animated objects from max:
- Create a model (sphere) with simple (30 sec) bouncing animation.
- Create a sequence named 'bounce' and set the begin/end keys (30 sec) in the curve editor (for the Sequence II).
- Create bounds for the sphere using DTS export utility (without bounds my export always crashes max).
- Using DTS Export Utility first Embed Shape and then export the object for the game.
Something is screwed up with my method here.. prob everything? :(
#4
Is the sequence named "bounce" (as you noted in your bulleted list) or is it "ballBounce" as you listed in your datablock code snipet" That will make a LOT of difference if this is the case. The datablock can't call for the sequence if it's named something else.
10/13/2007 (7:53 pm)
Nikhil,Is the sequence named "bounce" (as you noted in your bulleted list) or is it "ballBounce" as you listed in your datablock code snipet" That will make a LOT of difference if this is the case. The datablock can't call for the sequence if it's named something else.
#5
may i have to add this code to my game.cs file or write a specific cs file for this fonction ???
10/15/2007 (12:58 pm)
Question from a newbiemay i have to add this code to my game.cs file or write a specific cs file for this fonction ???
#6
Thanks, I'll take a look at it when I get back to Torque later (busy messing around with some other engine).
@ valie
Yeah, just create a new .cs (new text file, rename it) file for it, though I believe you can add this line to another .cs file without any issue, it's better to keep it clean and just create your own from scratch.
10/15/2007 (2:11 pm)
@ AlanThanks, I'll take a look at it when I get back to Torque later (busy messing around with some other engine).
@ valie
Yeah, just create a new .cs (new text file, rename it) file for it, though I believe you can add this line to another .cs file without any issue, it's better to keep it clean and just create your own from scratch.
#7
10/17/2007 (8:34 am)
For Nikhil : my animation is working well .. thank you for your help
Torque Owner cr
Bah. I didn't realize that this was one of those "wait for few weeks before someone replies" post. Oh well, I guess I'll search even more digging up even older content in the process.
*picks up the shovel.. 2000 polies*