- Home /
How to make an animation play always when walking in any direction?
I got a run animation which I want to play everytime the character walks in any direction. How would I go about doing this?
Answer by whydoidoit · Oct 15, 2012 at 06:34 AM
You basically want to blend the weight of the animation based on how far the character has moved in the last frame. Store the characters position every frame and find the distance moved.
Put "walk" on a higher layer to idle
Store the position of the character every frame
Work out the distance the character has travelled since the last frame
Use that to set the weight of the "walk" animation (you will need to work out how far moved to what weight looks right for you)
Check out the tutorial files for scene 10 of this tutorial there's a WalkAnimation.cs that tests how far the character has travelled and animates the walk rate accordingly.
Answer by Subzero619 · Oct 15, 2012 at 08:44 PM
Thanks alot but I don't really understand :(
I just set it to ping pong but once I click the attack animation that anim doesn't play again. I guess thats how its going to be.
Your answer
Follow this Question
Related Questions
Enemy animtion and movement 0 Answers
Joystick gamepad input overly sensitive 1 Answer
Character facing wrong direction when moving vertically 0 Answers
Override animation with another 1 Answer