Reverse Character Movement- Game Dev Series 130
Objective: create a backward walking animation.
When creating 3D character with movement animation, there is an easy way to create a reverse animation and apply it as a reverse movement, and this is what we are going to create in this article.
When we imported a walking animation to our character, we usually gives them one way animation.
To make a reverse animation, let’s open the Animator of character, and drag in another origin walking animation as a new one.
Rename it in Inspector, and set the speed to -1.
While playing this animation, you should see the character is walking backward.
Apply codes to it
Now we need to make this animation can be played when character is walking backward.
Create a float and a bool parameter.
The Speed parameter would be used to determine the walking direction of character, and the IsWalking bool would be used to detect is character standing still.
Assign them to both walking animation.
Make the walking animation played when character is walking and speed is greater than 0, then assign it to reverse walking animation when the speed is less than 0.
Now we can open the script and set the vertical input as moving speed to Animator.
And also assign the bool as true when either horizontal input nor vertical input are not 0.
All done! You can play and moving the character, and you should see a smooth walking animation.