Jondolf / avian

ECS-driven 2D and 3D physics engine for the Bevy game engine.
https://crates.io/crates/avian3d
Apache License 2.0
1.55k stars 120 forks source link

3D friction behaves unrealistically #489

Closed Jondolf closed 3 weeks ago

Jondolf commented 3 months ago

The current 3D friction implementation seems to be incorrect. As can be seen in the Gif in the README's "Usage example", the box stays essentially at the same spot despite dropping onto a corner.

Box dropping onto a platform

Intuitively, you would expect the box to tumble in some direction based on which corner hit the ground and how. In fact, this is what happens with a similar setup using Rapier.

Notably, our current behavior can be roughly replicated in Rapier with a friction of zero. It almost looks like our friction only kicks in once the box is flat on the ground and the contact points are clearly sliding along the surface.

A similar setup in 2D does seem to work correctly.

Jondolf commented 3 weeks ago

Another issue noticed by @tim-blackbird: friction causes some bounce for a box with locked rotation and zero restitution. Increasing the friction makes the problem worse, even without locked axes.

https://github.com/user-attachments/assets/ca9fd53e-bebc-4d53-834f-c6d081803185