# Calculating the force required to travel a specific distance

I’m trying to implement a dash mechanic in my 2D sidescroller game with physics based movement that allows you to dash a set distance in the 8 cardinal directions. Lets say I essentially want the player to be able to dash 5 units in any of the 8 cardinal directions, and I’d like to write a script that calculates the force required to do that, then applies that force. How would I go about setting up this math?

Note: if needed, the character’s mass is 1, their drag is 0, and the gravity in the game is set to -20 in the y value.

Allows you to understand the distance (s), time (t), velocity (u and v), acceleration (a) relationship. Scroll down to the bit "Constant translational acceleration in a straight line" to avoid the rather intimidating start.

Force = mass x acceleration lets you work out the force to apply (the time will be the fixed physics time step or multiples of).

You will need to compensate for your gravity, you can use the F = ma above to work out the force due to gravity.