Skip to content

PhysicsPort

export interface PhysicsPort {
apply(state: SimulationState): void;
}

A port that receives SimulationState and reflects the computation results to the DOM and other outputs. The Simulator calls apply() after each fixed timestep computation.

MethodDescription
apply(state)Writes state (position, velocity, etc.) to external targets (DOM, etc.)

In SimulationContext, PhysicsPort can be specified as a single port or an array. When multiple PhysicsPorts are provided, all apply() calls receive the same state.