Game Development Community

PlayThread / SetActionThread strangeness

by Jaimi McEntire · in Torque 3D Professional · 08/05/2009 (7:28 am) · 2 replies

I'm trying to code an animation for an AIPlayer. When he reaches a waypoint, I want to display an animation. However, both methods above result in some oddities. I'm using the following code in OnReachDestination:

%animation = %node.animation;
%obj.playThread(0,%animation); // %animation here = "jump".
//%obj.setActionThread(%animation,false,false);
%pauselen = %node.Pause;
if (%pauselen == 0)
%pauselen = 100;
%obj.schedule(%pauselen, "scheduledMove");

I've stepped through the debugger, and all the code is being called.

If I use SetActionThread, no animation plays, but nothing else bad happens.

If I use PlayThread, then the animation may - or may not - play. However, later on, his animations get screwed up and he skates around instead of running. For example:

Waypoint 1: Animation is supposed to play. Runs like normal to Waypoint 2.
Waypoint 2: No animation code is called (no animation at this waypoint).
Halfway to waypoint 3: his animation freezes, and he skates all the way to waypoint 3 and waypoint 4 - with his frame stuck on the last frame of the "jump animation". Which may or may not have played. At some point he unfreezes, and starts running again.

Any pointers would be appreciated. Thanks!



#1
08/05/2009 (12:20 pm)
Have you tried setActionThread with forceset=true ?
Also use wait=true.
If it does not play,it is possible,that there is a backworking sequence,that re-handles the action thread.
Another issue is if you set the action thread for long and what you see is a single frame of the sequence.
#2
08/05/2009 (7:47 pm)
Apparently, it was my poor choice of animation causing the problem. Jump must be hardcoded to do special things somewhere. When I switch SetActionThread to use "CelWave" instead, everything worked fine. Of course, I had to switch characters away from Gideon to the ForgeSoldier to get anything beyond the basics.
And PlayThread caused no end of havoc - I could get it to work, but it messed up the other animations, sometimes even much later. I don't know what is wrong with players and playthread, but I'll not be doing that again.