Day 102: Character Animation Part 5

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!




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

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Embed an Expert to Accelerate into the Cloud

SpaceX rocket launching into storm clouds.

Snowflake roles, visualized

Get to Know Git. Handy Git Commands to Keep You on Track.

Clone Laravel Project From Github

My First Week as a Software Engineer Apprentice

Graphic of coding bootcamp

100% Serverless

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Tyler Smallwood

Tyler Smallwood

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

More from Medium

Unity Dev Blog: How To Use Post Processing in Unity — It’s like an Instagram filter for your game!

Adding a Main Menu to our UI

What is a Control Track in Timeline

Light her up — Adding emissions to your game objects using photoshop and blender