I’m looking for details on how the Friction Joint works when it is used to apply “friction” to a Rigidbody2D. I’d like to be able to predict the max travel distance of an object that has the Friction Joint attached to it given the component’s Max Force property and a constant Mass, Linear Drag, Gravity (0) and initial velocity (power).
So far the formula I’m using is :
distance = (Math.Pow(power, 2)) / (2 * MaxForce)
this formula gets very close to the results I see in Unity when applying force to the object with the FrictionJoint, but it is not entirely accurate.
What is the formula the FrictionJoint uses when applying force to a Rigidbody2D? Or, how can I accurately predict the distance a Rigidbody2D will travel with a FrictionJoint given a AddForce of type Impulse?
It’s Box2D so here’s the source code for the b2_friction joint. Don’t forget that physics is time-integrated using small intervals so depending on what you’re doing you’ll get differences compared to a continuous function over a long period of time.
Thank you very much! I’m sure with enough analysis of this source code I’d be able to pull out the formula I need to predict just how far a given force will move an object.
Although, I have to admit, I’m not great at math. Is anyone who is better aligned for this kind of thing able to put together a formula that says: Given an object’s Mass, Impulse Velocity and FrictionJoint.MaxForce values, how far can the object travel, assuming no collisions take place?
I’m going to try to figure this out on my own and will reply back if I figure it out. But if anyone beats me to it that would be super helpful!