# Sleeping Bodies what wakes a settled pile, and how to edit one without waking it. ```{raw} html ▶ Run in browser ``` **Tags:** `physics` `3d` `sleeping` A pile of crates settles on the ground and falls asleep; a sleeping body is skipped by integration and the contact solve until something disturbs it, which is what keeps a large resting scene cheap. Bodies are tinted by their live sleep state, so the pile visibly dims as it settles and lights up the moment anything reaches it. The interesting half is what counts as a disturbance. Changing a body wakes what it was holding up: shrink the pillar under the crate on top and the crate falls, because the seam wakes its riders rather than waiting for a contact that has already gone. The same edit with ``wake=False`` moves the pillar and leaves the crate hanging in mid-air, which is the picture of what suppression buys (level streaming and pooled respawns do not re-simulate a parked scene) and what it costs (you now own the consequences). The other direction is handing a body TO the simulation. A crate can be streamed in parked -- dynamic and asleep where it stands, costing nothing until something reaches it -- which is what a level chunk arriving mid-game wants instead of paying to fall into place. A pile sleeps as a whole and wakes as a whole. Pull the bottom crate out of a stack and every crate it was holding up wakes in the same step, not just the one directly above it: the crate above is falling by the time the next collision pass runs, so a wake that reached one level would leave the rest of the stack asleep in mid-air. The HUD's drift readout is the other side of that bargain -- while a crate is asleep its pose does not change at all, which is what makes a settled scene free rather than merely quiet. Shows: - ``PhysicsBody3D.is_sleeping``, ``wake()`` and ``sleep()``: the read-back and the two explicit controls. - ``can_sleep``: a body that must stay simulated however long it rests. - Re-shaping a support wakes the bodies resting on it, through the node API (assigning ``CollisionShape3D.shape``). - The ``wake=False`` opt-out, which lives on the world seam rather than on the node: reached through the public ``body.world`` / ``body.handle`` pair. - The parked hand-over: a body freed into ``DYNAMIC`` and put straight back to sleep, which is what the seam does for a mode flip made with ``wake=False``. - Island-atomic wake: one crate taken out from under a stack wakes all of it. - Asleep is frozen: the HUD reports how far any sleeping crate has moved since it fell asleep, which stays at zero. - ``Capability.SLEEP``: a backend that does not advertise it never sleeps anything, so the HUD says so instead of showing a count that cannot move. Controls: 1 - shrink the pillar (default): the crate on top wakes and falls 2 - slide the pillar away with wake=False: the crate stays asleep 3 - slide the pillar away normally: the crate wakes and falls 4 - stream a crate in parked: it hangs where it lands until it is woken 5 - yank the bottom crate out of a stack: the whole stack wakes W / S - wake / sleep the whole pile C - toggle can_sleep on the pile Arrows - orbit the camera R - rebuild the scene Escape - quit Run: uv run python examples/features/physics/sleeping.py Headless self-check: uv run python examples/features/physics/sleeping.py --test ## Source ```{literalinclude} ../../examples/features/physics/sleeping.py :language: python :linenos: ```