# Body and World Knobs damping and gravity scale per body, the rest per world. ```{raw} html ▶ Run in browser ``` **Tags:** `physics` `3d` `damping` `gravity` `materials` A physics knob has exactly one home, and which one follows what the knob describes. Damping and gravity scale describe THIS object's dynamics, so they live on the body: a feather and a cannonball want different drag in the same air, and a balloon and a pickup want different gravity in the same world. Solver iterations, the sleep thresholds and the contact slop describe the space everything is in, so they live on the world, where one number governs every body. Three balls fall side by side from the same height with three damping rates, so the only thing between them is the knob. A balloon rises on a negative gravity scale and a pickup hangs on a zero one. Two tops get the same kick and wind down at different rates, because angular damping is independent of linear damping. Four crates share ONE ``PhysicsMaterial``: swap it and all four change surface at once, because a material is a resource many bodies hold rather than four loose numbers copied onto each. The world knobs are live, and visibly so. Loosen ``contact_slop`` and the settled crates sink into the floor; shorten ``sleep_time_threshold`` and the pile parks sooner. Changing one wakes nothing by itself -- a world knob names no body, so it cannot take support away from one -- which is why the key that changes the slop wakes the crates itself, or you would watch four sleeping boxes ignore it. Shows: - ``linear_damping`` / ``angular_damping``: the per-second rate at which a body sheds motion with nothing touching it, applied once per step as ``v = v * max(0, 1 - damping * dt) + a * dt``. ``0`` coasts forever. - ``gravity_scale``: ``1`` falls, ``0`` hangs where it is put, negative rises. - ``PhysicsMaterial`` as a shared resource: one instance, four bodies, and a live reassignment that reaches all of them. - The world knobs on ``PhysicsRoot.world``: ``gravity``, ``solver_iterations``, ``position_iterations``, ``sleep_time_threshold`` and ``contact_slop``. - That the two iteration counts are different dials: the solver one governs the velocity loop every body goes through, while ``position_iterations`` drains the error left in rigid JOINTS. Nothing here is jointed, so the readout is the only place it shows -- it is cycled anyway, because the knob belongs to the world beside the others and a scene that hid it would imply it did not exist. A jointed chain is what it acts on, and only on the two builtin solvers, which are the ones that run the seam's own position pass: see ``examples/features/2d/joints.py`` and ``docs/core/physics_backends.md``. - That a world knob is deliberately outside the wake gate, and what a scene does about it. Controls: 1 - drop the three balls again 2 - kick both tops again 3 - release the pickup (gravity_scale 0 -> 1), or park it again 4 - swap the material the four crates share (grippy <-> bouncy) G - world gravity: Earth / Moon / none I - solver_iterations: 4 / 8 / 32 P - position_iterations: 1 / 3 / 16 (joints only; nothing here is jointed) T - sleep_time_threshold: 0.1 / 0.5 / 2.0 s K - contact_slop: 0.001 / 0.02 / 0.1 (and wake the crates to show it) Arrows - orbit the camera R - rebuild the scene Escape - quit Run: uv run python examples/features/physics/body_knobs.py Headless self-check: uv run python examples/features/physics/body_knobs.py --test ## Source ```{literalinclude} ../../examples/features/physics/body_knobs.py :language: python :linenos: ```