-
-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle sleeping logic before physics (#425)
# Objective Currently, sleeping and waking is handled after physics. This leads to a one frame delay before bodies are woken up by things like velocity changes or applied external forces. It can even cause `ExternalImpulse` to do nothing, because the body is only woken up by the time the impulse should've already been applied and cleared. ## Solution Run sleeping logic before physics. User changes are detected by comparing component change ticks to a `LastPhysicsTick` resource. This refactor also lets us get rid of the `PhysicsChangeTicks` component, which was previously stored and updated for all physics entities. `PhysicsStepSet::Sleeping` now technically doesn't have much sleeping logic anymore, but that can be reworked in a follow-up.
- Loading branch information
Showing
3 changed files
with
37 additions
and
85 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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