Skip to content

PhysicsInterpolationSystem

Defined in: physics/src/PhysicsInterpolationSystem.ts:40

Computes each scene’s interpolation alpha, then blends previous and current physics poses into Transform for smooth rendering.

Runs in Update at priority -100 — ahead of particles (0), processes (500) and component updates (1000) — so game logic reads the same pose that is drawn this frame. Dynamic and kinematic bodies are interpolated; static bodies are skipped.

For kinematic bodies the Transform is also the input channel: before the lerp overwrites it, any pose the game wrote there is captured as the body’s next step target. The capture compares against the pose physics last wrote, so on frames where nothing else touched the Transform the lerp’s own (trailing) output is not fed back as a target.

Alpha combines the scene’s own sub-accumulator, holding scene time no step has simulated yet, with the game loop’s leftover frame time converted to scene time. It is clamped to 1: after a stall the loop caps its fixed steps per frame, so its accumulator can hold more than one timestep.

Iterates all scenes with physics contexts, including paused ones, so that a mid-frame pause doesn’t cause a visual pop. A paused scene — and a scene whose effective time scale is 0, such as during a freeze — skips the alpha recompute and keeps its frozen value, so the lerp writes the same pose each frame until the scene resumes.

  • System

new PhysicsInterpolationSystem(): PhysicsInterpolationSystem

PhysicsInterpolationSystem

System.constructor

protected context: EngineContext

Defined in: core/dist/index.d.ts:1086

Reference to the engine context, set on registration.

System.context


enabled: boolean

Defined in: core/dist/index.d.ts:1084

Whether this system is active.

System.enabled


readonly phase: Update = Phase.Update

Defined in: physics/src/PhysicsInterpolationSystem.ts:41

The phase this system runs in.

System.phase


readonly priority: -100 = -100

Defined in: physics/src/PhysicsInterpolationSystem.ts:42

Execution priority within the phase. Lower = earlier. Default: 0.

System.priority

_setContext(context): void

Defined in: core/dist/index.d.ts:1093

Internal

Set the engine context. Called by SystemScheduler when the system is registered.

EngineContext

void

System._setContext


optional onRegister(context): void

Defined in: core/dist/index.d.ts:1097

Called once when the system is registered with the engine.

EngineContext

void

System.onRegister


optional onUnregister(): void

Defined in: core/dist/index.d.ts:1101

Called when the system is removed.

void

System.onUnregister


update(_dt): void

Defined in: physics/src/PhysicsInterpolationSystem.ts:48

Called every frame (or every fixed step for FixedUpdate).

number

void

System.update


protected use<T>(key): T

Defined in: core/dist/index.d.ts:1095

Resolve a service by key, cached after first lookup.

T

ServiceKey<T>

T

System.use