EnginePort
Interface
Section titled “Interface”export type EngineResult = { position: number; velocity: number;};
export interface EnginePort { compute(dt: number, position: number, velocity: number, target: number, out: EngineResult): void;}PURPOSE
Section titled “PURPOSE”A port to implement a one-dimensional physics algorithm.
KineticsPort calls this port for each dimension to update position and velocity.
| Parameter | Description |
|---|---|
dt | Step time in seconds |
position | Current position |
velocity | Current velocity |
target | Target position |
out | Output object for results (position, velocity) |
Standard implementations provided: SpringEngine, LinearEngine, DirectEngine.
Custom implementations can be passed to use arbitrary interpolation algorithms.