Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compute_lagrange_update at very high masses #172

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

RJ
Copy link
Contributor

@RJ RJ commented Oct 10, 2023

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.

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.
@Jondolf Jondolf added bugfix A-Dynamics Relates to rigid body dynamics: motion, mass, constraint solving, joints, CCD, and so on labels Oct 10, 2023
@Jondolf
Copy link
Owner

Jondolf commented Oct 10, 2023

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)

src/constraints/mod.rs Outdated Show resolved Hide resolved
@Jondolf Jondolf added C-Bug Something isn't working and removed bugfix labels Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Dynamics Relates to rigid body dynamics: motion, mass, constraint solving, joints, CCD, and so on C-Bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants