Labs / QUBICENGINE HANDBOOK

Fixed-step physics

Change restitution and timestep, then step a simple falling body into a floor contact.

Inspect the relationship#

Change restitution and timestep, then step a simple falling body into a floor contact.

INTERACTIVE ILLUSTRATIONSIMULATION / BROWSER

A body meets a floor This illustration uses canvas. The explanation below describes the same process.

Change a control to inspect the result. Values describe the simulation, not native engine benchmarks. Open full lab ↗

Try these experiments#

Step a few ticks from rest. Velocity becomes downward before position changes. Play until the body hits the floor, then compare restitution zero with a value near one. Change the fixed timestep and observe how discrete integration/contact handling changes.

What the illustration calculates#

The one-dimensional model uses semi-implicit Euler: velocity changes with gravity, then position changes with that new velocity. A plane contact clamps the body center to its radius above the floor and reverses downward velocity scaled by restitution. This is a single-body contact model, not a full rigid-body solver. It omits broad/narrow phases, friction, rotation, constraints, and continuous collision detection. Its purpose is to expose timestep and response without hiding them in a large collision library.

Connect it to PhysicsWorld#

A production PhysicsWorld owns rigid-body state and collision objects at fixed simulation intervals. Scene consumes completed poses. Render interpolation smooths between poses without changing the solver step. Root-motion intent passes through a movement controller before authoritative collision resolution.

The update
text · REFERENCE EXCERPT
velocity += gravity * dt
height += velocity * dt
if height < radius:
    height = radius
    velocity = -velocity * restitution

A sophisticated solver handles penetration and contact constraints more carefully. A larger step can skip intermediate motion, so clamping the endpoint is not general continuous collision detection.

What to inspect when it is wrong#

Objects tunneling can indicate large steps or inadequate collision detection. Jitter can indicate multiple systems writing the same transform. A variable display frame rate should not directly change the physics timestep. Numerical stability and rendering smoothness are different concerns. Read physics and scene transforms.

Search titles and full article text.