How to set character velocity on each frame

Basically what I’m trying to do is replicate the air dodge functionality from Super Smash Bros Melee.

If anybody isn’t familiar with it’s behaviour, when the air dodge button is pressed, all momentum is cancelled, then the player moves (as far as I can tell, I can’t find a good video demonstrating it) in the direction of the analogue stick at what appears to be a fixed speed, exponentially decreasing to 0, over the course of about half a second. They aren’t effected by gravity during this period.

The method I’ve come up with is to set the characters x and y velocity to a value dictated by a float that ticks down every frame after the button is pressed. When the float hits 0, the x and y velocity return normal, being dictated by the character module.

What I can’t find is a way to, at any given point, set a characters velocity to a certain value, overriding all other forces on it.

1 Like