GameDevHQ 2.5D Cert Requirements Part 5
Objective: Create Player Roll Animation
As usual we start off in Mixamo to get a rolling animation. We import into Unity, change rig to humanoid, duplicate and move the copy into the animations folder then set up the animation in the Animator and create the transitions. We add a new parameter bool call Roll and use that for the conditions for transitioning.
We use a behaviour script like we did previously to tun off rolling after the animation transition.
For the game logic we run a conditional if statement to check if the left shift key is pressed and the player is moving in either direction and the player is not jumping before setting a rolling bool value to true and triggering the animation bool. A small edit to the jump script is needed to make sure the player can’t jump while rolling and we edit the Player movement so that the Player can’t change direction during the roll. We use the behaviour script to call a public RollComplete method in the Player script after the transition state exits.