Unity Development — Roll
Even before the days of Dark Souls, the dodge roll had its place in video games. It is a cool visual and provides a new form of movement for the player. Let’s take a look at one in action.
First, you’ll need a rolling animation. Once it is made, you’ll have to integrate it into the player Animator.
I have the roll animation able to transition from idle and running as I do not want someone to be able to roll when jumping or anything else. It is completely up to you, however, to change this.
I have also added a ‘Rolling’ parameter in the Animator and the Player script so that I can make adjustments when the action is occurring. Like the jump I have, the player will not be able to change their horizontal momentum once the roll has been commenced.
With a simple Input read, your player can be rolling. You can also make any other adjustments yourself within here. Perhaps you want a shield to appear when they roll. Or maybe have their collisions be undetected, that way they can avoid enemy attack on a roll. Play around with your rolls and see what works best for you.