How to fix this friction inconsistency in Matterjs
cod3kid opened this issue · 3 comments
cod3kid commented
When a sprite has a mass of 50 and friction of 0.001, if I apply a velocity on X direction, it travels 100 units before coming to rest. But when a sprite has a mass of 100 and friction of 0.002 (I've increased friction value because I've increased the mass), if I apply a velocity on X direction, it travels 105 units before coming to rest.
Why is that? I'm multiplying the friction value based on the mass of the sprite to make it consistent. But it is not. Am I missing something?
MLH-AIDS commented
- A
Number
that defines the friction of the body. The value is always positive and is in the range(0, 1)
. - A value of
0
means that the body may slide indefinitely. - A value of
1
means the body may come to a stop almost instantly after a force is applied. - The effects of the value may be non-linear. (Look at here!)
- High values may be unstable depending on the body.
- The engine uses a Coulomb friction model including static and kinetic friction.
- Note that collision response is based on pairs of bodies, and that
friction
values are combined with the following formula: Math.min(bodyA.friction, bodyB.friction)
MLH-AIDS commented
And the friction force in the real world is determined by the coefficient of friction and pressure, and changes in mass can affect pressure. But I don't know if this physics engine has this concept or not