Creating Player Roll Behavior
2.5D Game Development
Objective: Allow player to roll on the ground
To do the animation, we first need the animation itself so we go to mixamo.com and select the animation we like
Now download the animation with following settings
After the download, we need to configure it to work in our game so we first drag the downloaded animation in the unity, select the file and change to following
After you set this setting, select apply to save the settings. Then expand the file and you will be able to see various files and among them is the animation file so select the file with the animation name and cop it with Ctrl+D.
Then drag that animation inside your animator to set the animation conditions.
Make the transaction from run with a condition of bool value true and from rolling animation to idle with condition of bool value false.
Then inside the Update function of Player script, we need to set the conditions which will enable the rolling animation which in this case is when player holds S key and presses Space bar when in running motion.
And this is the final result.