updatePositionVerlet2D

View sourceupdatePositionVerlet2D(world: World): void

Advances matching 2D positions and velocities with the engine’s Verlet position step.

VerletIntegrator2DPlugin registers this exact function directly in the repeating AppSchedule.Update schedule. The registration does not specify a system group, so the schedule’s default group is used.

The query requires Position2D, Velocity2D, and Acceleration2D, in that order. Entities missing any of these components are skipped. The system uses the fixed 1 / 60 step in the source; it does not read Time.delta or VirtualClock.

For each matching entity, the system mutates the components in this order: it scales Acceleration2D by dt * 0.5 in place, adds that half-step to Velocity2D, writes Position2D as the updated velocity step plus the scaled acceleration step, adds the same half-step to velocity again, and finally clears acceleration to (0, 0). The static Vector2 helper return values are ignored; their explicit output arguments write into the queried components. Velocity2D is not otherwise replaced or cleared.

Examples

import { VerletIntegrator2DPlugin } from '@wimaengine/integrator'

app.registerPlugin(new VerletIntegrator2DPlugin())
// Position2D, Velocity2D, and Acceleration2D entities update during Update.

Parameters

NameDescriptionDefault
world

Update world containing position, velocity, and acceleration components.

—