Game Development Community

How to reset animation?

by Justin Tolchin · in Torque Game Engine · 03/30/2005 (12:42 pm) · 2 replies

Hi all,

Pretty basic question here (I hope). I have a non-cyclic "fire" animation that I play when I want my character to fire his weapon. I activate it using setActionThread("fire"). It plays fine the first time but when I want to fire the weapon again it won't play. I was stepping through the setActionThread code and I noticed that if it thinks the animation is already playing it just exits:

if (mActionAnimation.action == action && !forceSet)
      return;

So I changed the code to pass in "forceSet" as true and now it goes through the entire setActionThread code but it still doesn't play the animation again. How do I get it to actually reset the animation thread? I even tried calling setActionThread("idle") followed by setActionThread("fire") but that didn't work either.

Thanks!

#1
04/01/2005 (10:14 am)
I think I figured out what happened here. I guess most of the animations are driven from calling setActionThread on the server side. One exception is the attack animation which gets invoked on the client from RTSUnit.cc (by calling the doClientAttackAnimation function in game.cs). So my call to setActionThread on the server was just getting overidden by the call on the client which was invoking a sequence called "attack" which didn't even exist. So I just needed to change the client script to call my "fire" sequence (I'm also setting the forceSet flag to true).
#2
04/01/2005 (5:17 pm)
@Justin: I just spent a weekend or so muddling through the RTS-SK animation setup myself, so if you have any further issues, go ahead and open up a topic in the RTS-SK private forums.

They are sufficiently different enough for the RTS-SK implementation that answer from stock TGE owners may serve to confuse you--I know they did me!