Player Animations Part 2

Simon Leen
2 min readAug 28, 2021

Objective: Set up Players Running Animation

Following on from our idle animation the next animation we need to focus on is the run animation and transitioning from idle to run and back to idle.

We go to Mixamo again to find a suitable animation.

We use the in place setting as we want our controller to control the character movement and not the animation. We follow the same set up. Change the rig to humanoid, duplicate the animation so we can make changes and then move that new copy to our previously created animations folder. Add the animation to the animation controller for the Player and set up the transitions using conditionals.

Set up a float parameter for speed and set conditionals for the transition from idle to run if the speed is greater than 0.1 and back to idle if the speed is less than 0.1. Make sure has exit time is turned off for both of the transitions as this will allow the full animation to play when it should have already changed state.

Next in the Player script we create a private Animator and set it using GetComponentInChildren in the Start method. We then go inside the is grounded logic and first we will change from Input GetAxis to GetAxisRaw as this will allow our transitions to activate and move faster as with GetAxisRaw our values jump from 0 to 1 and not slowly increment. We then use anim set float to the Mathf.Abs of the input. We use the Mathf.Abs to allow the same logic for forward to work for backwards in that the negative values will read as positive.

We now have a running animation and transition. Later we will flip the character so the Player wont be doing the over agreesive moanwalk when the Player is supposed to be running left.

--

--