Platformer: Player Animation V — Idle Jump

Ryan McCoach
3 min readDec 31, 2021

--

Intro

In this article, I cover how to add an idle jump animation to the growing player animations.

Setup

For the animation we are going to Bake Into Pose all of the Root Transform because we are controlling the jumping height through the script and we do not want the animation to be controlling the animation.

We addd the Idle Jump animation to the Animator window. We want to be able to only transition to this Idle Jump if we are in the Idle animation. We will use a trigger parameter called “IdleJump” to go from Idle to Idle Jump.

The transition settings for Idle to Idle jump will be no exit time for the Idle animation, so we can go straight into the jump and the transition duration is 0. This, again, will transition instantly to the Idle Jump animation. The transition offset is .2. This starts the Idle Jump animation a little late to cut out some of the idle standing before the jumping animation starts.

The transition setting from Idle Jump to Idle is we will have Exit Time because we want to finish the entire Idle Jump animation before going back to Idle.The Transition is .25 so there is some blending between the Idle Jump to Idle making it look a bit smoother.

Code

Looking into the Player script, we just have to adjust the jump segment of the code. Jumping takes place when the space bar is pressed and the direction on the Player’s Y is increased by the Jump Height. After this, we will use the horizontal input to check if the Player is moving. If the horizontal input is = 0, then neither of the left/right arrow keys are being pressed so we are not moving. This is where we will trigger the “IdleJump” parameter. Else, will handle if the Player is moving and will handle the Running Jump functions for that animation that was previously in the code.

Conclusion

There were some other Idle Jump animations that were more visually appearing that I would like to revisit. The only reason I didn’t use them was figuring a way to pause the jumping movement for the Player a bit to sync up with the animation. This is not a bad start and as I learn more about the Animator I will revisit this animation. Until then…Cheers!

--

--