Repository navigation
fix: RigidBody::sleep puts its whole island to sleep - #1081
Open
kylegrahammatzen wants to merge 2 commits into
Open
kylegrahammatzen wants to merge 2 commits into
kylegrahammatzen wants to merge 2 commits into
Conversation
kylegrahammatzen
marked this pull request as draft
November 21, 2026 16:31
It used to set the flag only, so a body touching awake bodies kept being simulated while is_sleeping reported true, then froze in the air once they separated. Islands sleep whole, so the call is now a request to put the body's island to sleep. It is settled when the step applies the user changes: the island is split first if it lost constraints, and goes to sleep right then, where it is. The request is dropped when a body of the island cannot sleep: one woken up in the same step, a kinematic body in motion, one that never sleeps, or a soft body.
kylegrahammatzen
force-pushed
the
fix/manual-sleep-whole-island
branch
from
November 21, 2026 17:35
9a45d0c to
41c8681
Compare
kylegrahammatzen
marked this pull request as ready for review
November 21, 2026 17:36
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Calling
RigidBody::sleepon a body that touches awake bodies only set its flag, and since islands sleep as a whole, the body kept being simulated with the bodies it touches whileis_sleepingreportedtrue, then froze in the air once they separated.Now the call puts the body's whole island to sleep at the next step, where it is, and it does nothing when a body of that island can't sleep then, which is the case for a kinematic body in motion, a body with sleeping turned off and a body that was woken up in the same step.
Bodies that fall asleep on their own behave as before, and the existing determinism tests pass with the same hashes.