Game Development Community

Adding a walk animation

by Andrew · in Torque Game Engine · 10/19/2005 (10:35 pm) · 9 replies

I want to use patrol bots for my level but I don't want the bots running everywhere. I was hoping to make the bots walk along their paths and then run and attack me if they see me. Is this possible?

#1
10/19/2005 (10:56 pm)
Keep in mind that while the animation itself is labelled as "run", and enumerated in the code as "RunForwardAnim", the speed at which the animation is cycled is controlled by the actual velocity the player/bot is moving. In other words, if you don't want your bots "running", then limit their velocity...there aren't any animation changes required.

Of course, if the animation for your particular bot for walking is drastically different from what it would look like running (I'm talking bone movement different, not speed of animation different), then you may in fact want to make a separate "walk" animation. This isn't common however, and does require several code changes in multiple locations.
#2
10/19/2005 (11:33 pm)
I see. Where do I find the code to limit the velocity?
#3
10/19/2005 (11:41 pm)
That would most probably be part of your AIPlayer::processTick() or AIPlayer::updatePos(). Look for calls to ::pickAnimationThread(), and then analyze the physics (specifically the mVelocity modifications) being applied.

Additionally, ::pickAnimationThread() is where the mVelocity is being calculated, and then applied to determine which animation to play, so you may want to have a modifier to the velocity there--really depends on your bot implementation, max speed, and associated parameters.
#4
10/19/2005 (11:44 pm)
In /server/player.cs you can change the speed - I think it's called MaxForwardSpeed, MaxBackwardSpeed, and MaxSideSpeed or something similar. You can't change it on the fly without touching some code though. Check out this resource for how to do that.
#5
10/20/2005 (12:14 am)
I see. Where do I find the code to limit the velocity?
#6
10/20/2005 (12:20 am)
But if I change the velocity then when the bots see my player, they will "walk" towards me won't they?
#7
10/20/2005 (6:10 am)
Using the the Run animation to walk does not look good...

What Stephen mentions is the easy way. So it really depends on your ability or willingness to try ;)

The harder (and probably the correct) approach is to add a walk animation.
#8
06/23/2006 (3:37 pm)
Quote: Of course, if the animation for your particular bot for walking is drastically different from what it would look like running (I'm talking bone movement different, not speed of animation different), then you may in fact want to make a separate "walk" animation. This isn't common however, and does require several code changes in multiple locations.

@Stephen - What code changes would be necessary to make this happen? Having explicit control over the movement animations is going to be a critical part of my game development.
#9
11/11/2006 (11:59 am)
Anyone get anywhere with the seperate walk animation process ? I am thinking I can create a new DTS with a new walk-animation as sequence0 and require no engine changes at all.