Detecting how much force is needed to bring a rigidbody's velocity to zero

What's the method to use to detect how much force is needed to bring a rigidbody's velocity to zero on a given FixedUpdate()?

Here's the context of my question:

I'm creating a raycast car using a rigidbody applied to the car's body, and four raycasts to programatically create the tire/suspension sytems.

Currently I'm stuck trying to programatically add tire friction into the system. For now I'm just assuming all 4 tires are locked up so the car is effectively skidding on 4 rubber pads.

I know how to get the velocity vector of each tire tangent to the surface it's skidding on, so it's trivial enough to appply a force to the car's rigidbody in the opposite direction using AddForceAtPosition(). My problem is that as the velocity of the car is slowed down by this friction force, at some point that friction force is too strong in relation to the velocity it's opposing and it pushes the car in the opposite direction (instead of just stopping it perfectly).

Therefore, before applying the friction force each FixedUpdate(), I need to check to see if it exceeds the force required to bring the rigidbody to a standstill, and if it does, apply that force instead.


Well, the answer seems to be to use the ol' Force = Mass x Accelleration. I wasn't sure how to implement the accelleration within the FixedUpdate() function, but apparently just supplying the current velocity vector that I'm trying to counter wity my friction seemed to do the job.

The trick, though, is that you have to counter not only the velocity of the rigidbody, but also counter any forces acting on the object as well. Once I took that into account, I seem to be able to generate the proper friction forces on each rubber pad (tire) to stop the car when it's skidding.