updateOrientationVerlet2D

View sourceupdateOrientationVerlet2D(world: World): void

Advances matching 2D rotation state with the engine’s Verlet torque 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 Orientation2D, Rotation2D, and Torque2D, 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 first scales Torque2D.value by dt * 0.5, adds that half-step to Rotation2D.value, and constructs a rotary increment with Rotary.fromAngle using rotation.value * dt + torque.value * dt. It then calls Orientation2D#multiply, but discards the returned rotary value. Because the current multiply() operation returns a new value rather than writing into the component, Orientation2D is unchanged by this function. The system then adds torque.value * dt * 0.5 to rotation and clears Torque2D.value to 0.

Examples

import { VerletIntegrator2DPlugin } from '@wimaengine/integrator'

app.registerPlugin(new VerletIntegrator2DPlugin())
// Rotation2D and Torque2D are consumed during the app's Update pass.

Parameters

NameDescriptionDefault
world

Update world containing orientation, rotation, and torque components.

—