Skip to content

KinematicsSystemOptions

Defined in: src/modules/kinematics/kinematics-system.ts:35

Options for makeKinematicsSystem.

The system iterates every entity that carries all of Position, Velocity, ShapeAabb, and Grounded — those are the “dynamic bodies”. For each, it applies gravity (clamped to terminalVelocity on the way down), then resolves motion against any entity yielded by broadphase that also carries staticTag.

Resolution uses a two-pass axis-separated push-out: X first, then Y. Against each overlapping static, the body is snapped to the nearest non-penetrating edge and the corresponding velocity component is zeroed. This mirrors Arcade-style platformer physics and avoids the tunneling pathologies of a naive overlap check.

broadphase is called once per axis per body with the axis-projected target AABB. Consumers typically dispatch a spatial-grid or tag iterator here.

TCtx extends KinematicsTickCtx

readonly broadphase: (ctx, x, y, w, h) => Iterable<EntityId>

Defined in: src/modules/kinematics/kinematics-system.ts:51

Yields candidate static-body ids that may overlap the given AABB. The system filters the results by staticTag, so over-yielding is safe (and typical for grid broadphases).

TCtx

number

number

number

number

Iterable<EntityId>


readonly gravity: number

Defined in: src/modules/kinematics/kinematics-system.ts:38

Downward acceleration in world-units per second².


readonly optional name?: string

Defined in: src/modules/kinematics/kinematics-system.ts:36


readonly optional phase?: string

Defined in: src/modules/kinematics/kinematics-system.ts:39


readonly optional runAfter?: readonly string[]

Defined in: src/modules/kinematics/kinematics-system.ts:40


readonly optional runBefore?: readonly string[]

Defined in: src/modules/kinematics/kinematics-system.ts:41


readonly staticTag: TagDef

Defined in: src/modules/kinematics/kinematics-system.ts:43

Tag that identifies immovable obstacles.


readonly terminalVelocity: number

Defined in: src/modules/kinematics/kinematics-system.ts:45

Maximum positive vy (falling speed cap).