Platformer: Player Animation Part 3 (continued)

Ryan McCoach
3 min readDec 12, 2021

Intro

In this article I go over the fixes for the issues from the previous player jumping and idle transitions.

Jumping to Idle Animator

We want the transition from jumping to idle to be instantaneous, so we want to change the Jumping parameter from a Trigger to a Bool. A Trigger parameters are good for animations that have multiple animation transitions it needs to make often. Trigger parameters are great for animations that have time to play like death animation, power up animation, etc. With Jumping now a Bool, we will set the condition for the transition from Jump to Idle to be Jumping = false.

When we jump and go to Idle, the transition is stuck. This is due to the Jump to Idle still has Exit Time true, meaning it needs to finish the jump animation before moving to Idle. By setting the Exit Time false, this will fix this issue.

Running to Jump Animator

We will use our new Jumping bool to make the transition condition from running to jumping. The Jumping bool will need to be true to make the transition play.

Jump to Running Animator

For the transition from jumping back to running, we will use the Jumping Bool parameter and the Speed Float parameter. If the conditions that need to be met for the transition to happen are Jumping is false and the Speed is greater than 0.1.

The Code

We are going to create a bool to keep track of when the player is jumping. We set it to false to begin.

When the spacebar is pressed, we set the jumping bool true, and set the Jumping animation bool to the jumping bool, which is true. This will play the jumping animation.

When we jump the character controller is no longer grounded or true, so nothing in the controller.isGrounded will run. When the player lands, or jumping bool is true and we will want to set it to false, as well as, the jumping animation bool to the jumping bool, which is now false.

Conclusion

This cleans up the animation transitions and makes the player movement more realistic. In the next part of the player animation, we will flip the player when move left and right.

--

--