← Documentation Home

UpdatePhysics

Category: 2D Game Physics (Pro)

Back to System Functions


Signature

UpdatePhysics(world As Integer, seconds As Double)

Returns

Void

Description

Advances gravity, movement, broad-phase collision detection, contact impulses, friction, penetration correction, and collision reporting.

Performance and behavior

Normally pass FrameDelta(). A fixed 120 Hz accumulator provides stable game behavior across frame rates. Catch-up is capped at four steps (about 33 ms of simulated time per call), preventing a stalled frame from causing a simulation spiral. The broad phase uses insertion-sorted X sweep and prune and rejects non-overlapping cached Y bounds. Exact contacts are generated once per step and reused by eight impulse passes. Low-speed restitution suppression, contact damping, and automatic sleep prevent resting piles from accumulating jitter. Body setters and sufficiently fast impacts wake sleeping bodies.

Pro feature: compiling code that uses this function requires a license with the GamePhysics feature enabled.

Example

UpdatePhysics world, FrameDelta()