Game Development Community

Controlling animation playback

by Andy Hawkins · in Torque Game Engine · 10/24/2005 (7:26 am) · 6 replies

I have made a beast which doesn't carry weapons, it just slashes as the first of it's melee style attacks. To do a quick hack without modifying the SDK I changed the dsq for "light_recoil" to use my slashing animation.

I have found a problem using this method. If I arm the beast with a weapon, it plays the slash animation (alias is light_recoil as it's sequence name) as would be expected - but if I don't mount a weapon the slash anim doesn't play.

I mean it makes sense, that the beast doesn't have a gun, so Torque wont play the light_recoil (slash) anim anyway.

SOOOO.... how do I implement the slash as an attack animation instead of firing and having to mount a weapon?

At the moment I load the animation using this code...

datablock TSShapeConstructor(PlayerDts)
{
   baseShape = "./beast1.dts";
   sequence0 = "./beast1_root.dsq root";
   sequence1 = "./beast1_run.dsq run";
   sequence24 = "./Beast_Slash1.dsq light_recoil"; ...  and I commented out the rest....

Also ...is sequence important? (as above)

Maybe I'm asking legacy questions, but I'm having trouble finding a definitive guide to dts animation and replacment.

#1
10/24/2005 (7:48 am)
Have you tried .setActionThread()?
#2
10/24/2005 (4:44 pm)
I don't think that will make any difference. Torque will override this with it's own in-built event driven animations - this is what I am trying to circumvent.
#3
10/25/2005 (5:57 am)
I have done something similar, use .setActionThread but don't use 0. Torque can play a number of threads at once, I think it uses thread 0 for the main actions (Running, etc), so try 1 or above. If the animations are done correctly it will blend them together. The Pro showTool is good for testing this out as you can play the anims on different threads and check the blending attributes.
#4
10/25/2005 (6:32 am)
Since anything can be a weapon by putting it in the weapon class, how about simply making a very tiny object and put a mountpoint on it. Then call it a weapon and arrange it so when mounted it is inside the creatures hand so it doesn't show. Then when you spawn the creature automatically give it this "weapon" and now it will play the slash animation.

I would think that would circumvent the problem nicely.
#5
11/06/2005 (9:08 pm)
What I've decided to do is actually make the weapons the claws on the end of the fingers, so I can animate them coming out. If I want the beast to spew fire or acid I can make the weapon teeth or a tongue. Nice solution that doesn't required me to mod the code.

Can I override the base class definition (TSShapeConstructor) during the game to change "firing" animation?

So at the start I tell it to use light recoil anim for firing(slashing) but later you might come across another version of the same beast which does a double slash - so I'd want to override the light recoil anim with either a preloaded dsq so it would now access sequence24 or load it at runtime when required into sequence25 and use that instead.

How would I do this?
#6
03/08/2006 (3:31 pm)
On the same topic I have a beast that I want to make fly. I thought if I set the animation for fall as the flying animation it should work pretty well, so I make him jump into the air, adjust his gravity to really light and then he should float down, while flapping his wings. Probably use this resource for the gravity etc...
Making a player fly

I guess I'm probably answering my own questions, but I wanted put it on this topic to see if anyone has done this and might have a good solution. Also it's here for the benefit of others so when I solve it, it will be a useful resource.

My questions are...

1. Where do I add the animation to attack while in the air? I assume the DSQ will blend flying and slashing, but am I running an animation thread on this? Say on channel 1 or something? Or do I make a flying animation that is also slashing?

2. Is the thread usage documented, or am I free to use any channel other that 0?

3. The sequence24, 25 stuff is a bit strange. I've found this document which outlines the sequence structure...
TSShape::Sequence Struct Reference
...but I wanted to know if there are any reserved for standard animation that comes with Torque or I can override them or is Torque going get all shirty about it and fight me???