Game Development Community

Why Player::pickActionAnimaion changes animation based on speed?

by H.W. Kim · in Torque Game Engine · 02/04/2008 (7:05 pm) · 6 replies

I wonder why Player::pickActionAnimaion function changes animation based on players speed?

Is there any other reason to do that?

I know it is not just concerned only to the engine but related to the art pipeline, so it should be correctly specified within a DCC tool to get right shape instance in the game.

But as my oppinion, it makes whole thing of the work pipeline a bit complicate even it may not need for some game.

Just want to know about hidden reason before going further. :-)

Thank you.

#1
02/04/2008 (10:18 pm)
I think that pickActionAnimation uses velocity to determine which animation to use. So if the player's moving forwards, it plays the forwards animation - if it's moving sideways, it plays the sideways animation.
#2
02/05/2008 (12:32 am)
My question is why it uses *SPEED* instead of other factor?

We can directly change animation whenever press move key, for instance forward animation for 'w' key and left strafe animation for 'a' key and so on. But pickActionAnimation uses speed to determine its direction.

Just want to know is there any other reason to do that. :-)

And adding to that, whether there is side effect if I rewrite pickActionAnimation not use player's speed to change its animation.
#3
02/05/2008 (1:16 am)
PickActionAnimation doesn't occur in response to a key press. It runs after an animation sequence ends, so for all intents and purposes it is pretty much always running. What happens is that when you press one of those keys more than likely you change your velocity (unless you're falling or something). pickActionAnimation uses that speed to determine the animation to play. If you're not moving forward or back but are moving side to side, (figured out with the vector math), it picks the strafe animations. It relies on the specific ordering of the animations as enums also.

So, the whole point of the function is to choose an animation based on your current velocity and feed that action into the setActionThread function. If you were to rewrite the function, you should reproduce similar functionality, keeping in mind all the different ways setActionThread is called.
#4
02/05/2008 (2:13 am)
The root reason that he's asking for is because if you don't procedurally determine what speed to play the selected animation, based on the velocity of your player in the game world, is that it looks ridiculous in game.

Imagine if you will for a moment your player zooming across your world at a reasonable run speed, but his animation is playing at the stock speed the animator set--his feet won't hit the ground in time with his movement, and he will appear to be "floating", or "skidding" (depending on the differences in forward movement versus animation play speed).

Or just think what it would be like to see a person walking at a slow pace, while his feet moved as fast as a 100 meter dash sprinter.
#5
02/05/2008 (3:04 am)
I've modified the engine, so it picks up automatically the "walk", "run" and "sprint" animations. The current system is a good one.
Another benefit - if the player goes up on hill, hes speed goes down and run animations automatically slows down until it switches to walk.
#6
02/05/2008 (10:43 am)
Use anim.speed to change that.