Calculating the force required (Rigidbody)


i was wondering how i could calculate how much force i would need to apply to a rigibody to get a certain speed (velocity.magnitude, lets say its 50 for this example) providing i have the following settings on my rigidbody

No Gravity
Everything else is set to default with the exception of drag
Drag = 5

so i have drag(5) and velocity.squaremagnitude (50), now i need to calc how much force i need to apply. to get my speed (velocity.squaremagnitude (50))

force=1/2mvv which m is mass and v is velocity.

I’ve put a couple of answers together and came up with this:

Vector3 forwardSpeed = (rigidbody.transform.forward * desiredSpeed);
Vector3 force = (forwardSpeed.normalized * rigidbody.mass * desiredSpeed);
force = (rigidbody.drag*force)/(1-0.02f*rigidbody.drag);


This works perfectly for me as you can see here.
The console shows TopSpeed which calculates the terminal speed with a given force/drag/mass:

float terminalVelocity = ((force.magnitude / rigidbody.drag) - Time.fixedDeltaTime * force.magnitude) / rigidbody.mass;

and Speed which is just the value of the slider or desiredSpeed. If both are equal that means the math works =)

This will not work when gravity is in play and collider is touching other collider, like a box on a flat plane. The equation needs to have this drag taken into account.