Objective: Add an animation when the player jumps in idle state
For this example I downloaded the idle jump animation from mixamo.com and imported it into my unity project.
Then we have to add the animation to the player animator controller and create transitions, one from the idle state to the jump animation and another from idle jump to idle. Also we need a bool parameter to trigger the animation in the code.
In the calculated movement function we have to check for the space key to trigger the animation. There is another function calle set grounded values, this function is just to make the transition from jump to idle again and it is called when the player does not presses the space key in the calculate movement function.
And that’s it!!! We a have a new idle jump animation for the player.