Game Development Community

Skating Bots, Help!!!!

by Kimberly Unger · in Torque Game Engine · 10/28/2003 (2:51 pm) · 12 replies

I have a Bot that is NOT based on the player shape. I use the "aiSpawnPlayer()" method to place the Bot. Everything works just great except the 'run' animation does not play when the Bot moves. The documentation says that the 'Run' animation sequence of the DTS file is the default and the "setActionThread()" method is overridden. I have tried moving the Bots with and without the "setActionThread()" with the same results, the Bot moves but stays with the same animation sequence that was selected before movement started. Any idea on what needs to be changed?

Here is how I setup my Bot movement.
=============================================================
$Bot[%index].setMoveSpeed(0.25);
// Get player object transform
%transform = $Bot[%Index].getTransform();
%posX = getWord(%transform, 0);
%posY = getWord(%transform, 1);
%posZ = getWord(%transform, 2);

%newxy =  getRandom(-10, 10);

if(getRandom() <= 0.5)
    %posX +=  %newxy;
else
    %posY += %newxy;

%new_pos = %posX SPC %posY SPC %posZ;
                      $Bot[%index].setAimLocation(%new_pos);
                      $Bot[%index].setMoveDestination (%new_pos);

#1
10/29/2003 (4:15 am)
Does the run animation work in the show tool, for the shape you're using?
#2
10/29/2003 (1:24 pm)
Yes, both 'Run' and 'Walk' animation sequences run and the are both cyclic, that is the repeat automaticly.
#3
10/30/2003 (6:57 pm)
Are they blended animations? I seem to remember having a problem like that do to not having blended animations. Been a while though.
#4
10/31/2003 (1:12 pm)
Tried using a blended animation and it had no effect what so every. :(
#5
12/01/2003 (8:38 am)
I have this occasionally with my bots too. Sometimes for some reason, the animation stops but the bot still moves...
#6
12/03/2003 (12:08 pm)
Look in player.cc in the engine around line 123, the line:

{ "run", { 0,+1,0 } }, // RunForwardAnim,

The run animation is called when the objects speed is 1, and I notice you setMoveSpeed(0.25);

Not sure if this will help, maybe play with it, good luck.
#7
12/05/2003 (11:11 am)
No effect what so ever. When looking at the code I noticed that the {"run",{0,+1,0}}, 2nd set on brackets are used to define default direction vector (see the player.h file line 120 for the 'ActionAnimationDef' structure definition). I was wondering where you say that the vaules control when the animation is run. Studing this just might give me a clue as to the solution problem.

DYI: We have been able to use the 'player' files (cs, dts, dsq, etc) from the Example folder. It works just fine. We are now trying to figure out just what is different between the player art files and the Bot file we created.
#8
12/05/2003 (11:31 am)
Not sure but could it be because the move destination is too small? Check the output of %newxy from the getRandom(-10, 10). Also, if this is called every game tick, that means that getRandom(-10, 10) could return a negative value, then a positive, then a negative... and so on, so the bot migh stay about where he was...

Maybe that's your problem.
#9
12/05/2003 (3:54 pm)
It doesn't look like the %newxy is to small, although you do have a good point, I need to make sure the value is a nonzero value. The script to make the bot move is no called every tick, but only when the bot needs to have a destination for walking created.

We can see the bots move in the world, they just stop the animation they were playing and then skate over the ground to the ground.
#10
02/27/2004 (1:32 pm)
Any luck with this? I'm having the same problem...thanks!
#11
02/27/2004 (2:32 pm)
Yes, the problem is that Bots don't start automatically like players. You need to use playThread(). Here is what I've found works:

$Bot.stopThread(0);
.
.
.
.
$Bot,playThread(0, "walk");

I hope this helps.
#12
02/28/2004 (9:20 pm)
Yes, that worked perfectly - thanks for the help!