How do i create a dive-roll or slide mechanic

How would i create a dive-roll or slide mechanic would i work it just like a sudden burst of speed and put in an animation for it or is there more to it whats a good way to go about doing this

You can either add movement input to your pawn while playing an animation (slides would lend well to this) or you could use an animation with root motion (would make a nice roll).

The first way allows you to easily edit the distance of your slide/roll but makes for trouble if you have an action where feet could slide and requires typically that your motion be pretty simple.

The root motion animation method is great for anything you want to feel really grounded (feet not sliding) and is really great for staggered/specific motion (like a stumble then fall or a zombie shuffle). Downsides are that all changes to the motion must be handled in the animation. You can often reach an issue of wanting to tweak the speed or distance and making the animation looks bad so you have to just reanimate.