Day 102: Character Animation Part 5

Tyler Smallwood
3 min readDec 6, 2021

Objective: Get the player jumping.

Today the player will look like he is jumping now! First thing first is to get the jumping animation from Mixamo.

Download and select FBX for Unity and with Skin selected.

We need to rig to humanoid. Next is to duplicate the animation.

As with the past animation clips, we will drag it into the animator window.

Now make transition lines to and from jump, offensive idle and fast run.

We will need a parameter to listen for on each of the transition lines. For this we will check to see if we are jumping as a bool. So in the parameter create a bool named Jumping.

Now for the transition lines going from Offensive Idle and Fast Run, we’ll add the condition if Jumping is true. We will also deselect “Has Exit Time” and Transition Duration to zero.

Both of the transition lines leaving jump to Offensive Idle and Fast run will have different conditions. We will check to see if jump is false and if Speed is less than .1 for going back to Offensive Idle. If jump is false and Speed is greater than .1, we’ll move to fast run. Offsenive Idle will also have Has Exit Time deselected and Transition Duration at 0. To Fast run we will have Has Exit Time selected to make the jump more noticeable.

Transition line Jump to Offensive Idle.
Jump to Fast Run.

It’s time for the code to active the jump animation! In the player script we will need to know when we are jumping to set the animator bool to true. Where we check for player input to jump is where we will add _anim.SetBool(“Jumping”, true);.

To help set the Animator bool back to false to allow us to jump again and not replay the animation over and over, we will create a global variable called _jumping. In the jump section, after setting the animator to true, we set the _jumping to true. Now before checking player input for moving we will check to see if _jumping is true and if it is, set _jumping to false and the animator bool Jumping to false.

This help’s the animation to move back more naturally.

This is been a fun ride learning about animation for the player. Thank you for reading and have a wonderful day!

--

--

Tyler Smallwood

I am passonate on learning to program and use Unity to become a skillful Unity Developer