In real-life physics, the static and dynamic friction an object experiences due to being in contact with a surface is proportional to the the normal force that surface applies on the object.
Consider a simple scenario where you have a box resting on a table. The table is applying a normal force on the box equal to the box’s weight. If I put more things in the box, the weight of the box increases and so does the normal force, making it so the box will experience more static and dynamic friction if I try to push it across the table.
In Unity, this does not appear to be the case.
I have a test where I have an oscillating platform moving left and right that is controlled by a kinematic Rigidbody (I am moving it in FixedUpdate with Rigidbody.MovePosition, so it should work properly with physics). I then drop a Rigidbody cube on the platform. I have set the static and dynamic friction coefficients on the physics materials of both objects such that the cube slides around on the moving platform a bit as it moves back and forth.
However, if I increase the mass of the cube, even up to ridiculous numbers like 99,999 kg, it still slides around the oscillating platform just as if its mass were 1 kg. I can get the cube to stop sliding around by increasing the coefficient of static and dynamic friction on the physics materials, but I feel like I should also be able to do this with the mass as well. Without friction respecting mass, it becomes harder to set coefficients of friction for a globally consistent physics simulation.
Has anyone else observed this behavior? Am I doing something wrong? Is this a bug in Unity or an intentional limitation?
The friction force is proportional to the normal force.
Increasing the mass causes a proportional increment in the normal force, and thus in the friction force.
The mass is also larger. A larger mass requires more force for it to actually move. This is the missing point in your approach.
So increasing the mass actually increases the friction, but this larger friction acting over a larger mass produces the same exact result as if it hadn’t been increased.
While this specific case looks correct, note that you cannot rely on the coefficients of friction. Physics in Unity are heavily optimized for performance. As result, the friction model is completely faked and it doesn’t behave consistently.
In practice, this leaves configuring friction to just trial and error until finding some values that mostly look correct in most cases. Simple box colliders will mostly behave properly when friction coefficients are configured to the half of what should be in reality. Complex MeshColliders may have a largely variable number of contact points, so you can’t really predict what will happen in terms of friction.
Ah yes, you are correct. Just did a free body diagram for a block sliding on a flat surface with some initial velocity and this reasoning makes sense. It is the same reason objects of different mass fall to the ground at the same rate if only under the influence of gravity. Been awhile since my physics class so I’m a bit rusty on this stuff!