bevy_xpbd
bevy_xpbd copied to clipboard
Fix compute_lagrange_update at very high masses
With very dense colliders / very small inverse masses, the inverse mass sum was < EPSILON, and I was getting no collision response.
Slow dynamic bodies with a high mass and inertia were passing through static bodies.
This sets a minimum inverse_mass amount so there's still a response.
I've no idea if this is correct, I have only verified that it solved the problem I was seeing in 2d.
Nice catch, I think it's correct like this. I was originally worried that dividing by epsilon could still result in infinity in some cases, but I think in Rust that would only happen if the divisor is exactly zero (within the bounds of f32/f64)
(note: CI is currently failing because of unrelated linking/storage issues so you can ignore it)