group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
Sleep.hpp File Reference

Body sleeping + constraint-island detection. More...

Include dependency graph for Sleep.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  physics::SleepConfig

Namespaces

namespace  physics
 Pure physics math — no ECS types, no registry.

Functions

void physics::updateSleep (Registry &registry, const SleepConfig &cfg)
 Update each body's sleep state from its current velocities.
void physics::wakeIslandOf (Registry &registry, const ContactCache &cache, entt::entity e)
 Wake every body that's currently in the same contact island as e.
void physics::wakeBody (Registry &registry, entt::entity e)
 Wake a single body (e.g.

Detailed Description

Body sleeping + constraint-island detection.

Bodies whose energy stays below threshold for sleepTimerThreshold frames are flagged asleep (RigidBody::isAsleep) and skipped by the solver / integrator until something wakes them — usually a new contact from an awake body or an applied force/impulse.

Islands group contacts and joints into connected components of the constraint graph: an island sleeps only when all its bodies sleep, so e.g. a stack of boxes wakes all at once when the bottom one is kicked. Phase 12 ships per-body sleep — island-level sleep is set up via the wakeIslandsOf(...) helper that walks the contact graph.