bevy_xpbd icon indicating copy to clipboard operation
bevy_xpbd copied to clipboard

Fix compute_lagrange_update at very high masses

Open RJ opened this issue 2 years ago • 1 comments
trafficstars

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.

RJ avatar Oct 10 '23 09:10 RJ

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)

Jondolf avatar Oct 10 '23 09:10 Jondolf