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

Rigidbodies never sleep #357

Closed
Klohger opened this issue Apr 3, 2024 · 2 comments
Closed

Rigidbodies never sleep #357

Klohger opened this issue Apr 3, 2024 · 2 comments
Labels
C-Bug Something isn't working C-Regression Behaviour that was working before is now worse or broken

Comments

@Klohger
Copy link

Klohger commented Apr 3, 2024

Whenever a rigidbody begins sleeping, it immediately gets woken up. I've tried debugging, and I'm guessing the problem is that the change of external forces needs to be checked if they're above the sleeping threshold. I'm not exactly an expert when it comes to physics engines, so I cannot exactly say where the fault lies.

@Jondolf Jondolf added C-Bug Something isn't working C-Regression Behaviour that was working before is now worse or broken labels Apr 3, 2024
@Jondolf
Copy link
Owner

Jondolf commented Apr 3, 2024

I think this issue might've been introduced by automatically inserted apply_deferred systems added in Bevy 0.13. The sleeping logic was previously relying on some rather questionable and precise scheduling, and there might be some new apply_deferred systems that break it. I'll try to look into this more to verify.

Either way, I think the sleeping logic should be partially rewritten as it's currently not very robust or optimal. I have plans to experiment with "simulation islands", which would both increase parallelization and help handle sleeping properly.

@Jondolf
Copy link
Owner

Jondolf commented Jul 6, 2024

This was partially fixed by the solver rework (#385) in Avian 0.1. Bodies should now fall asleep again, but only if they're not interacting with other dynamic bodies. I'll close this, and open a separate issue for simulation islands soon

@Jondolf Jondolf closed this as completed Jul 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Bug Something isn't working C-Regression Behaviour that was working before is now worse or broken
Projects
None yet
Development

No branches or pull requests

2 participants