liabru / matter-js

a 2D rigid body physics engine for the web ▲● ■
MIT License
16.62k stars 1.96k forks source link

How to fix this friction inconsistency in Matterjs #1311

Open cod3kid opened 4 weeks ago

cod3kid commented 4 weeks ago

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 4 weeks ago
MLH-AIDS commented 4 weeks ago

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

cod3kid commented 3 weeks ago

@MLH-AIDS Yes, it is non-linear. But is there a way to fix it? That's my question, thank you for your response