Examples
import { AppSchedule } from '@wimaengine/core'
import { updateBodies } from '@wimaengine/physics'
app.registerSystem({
schedule: AppSchedule.Update,
system: updateBodies
})
// Physics2DPlugin already registers this system for its app.Function
updateBodies(world: World): voidApplies each body’s transform to its Collider2D component.
Physics2DPlugin
registers this exact function directly in the repeating
AppSchedule.Update
schedule. It has no explicit system group, so it uses the schedule’s
default group and runs before the physics plugin’s broadphase and collision
response systems, which are registered afterward.
The query requires all four components in this order:
Position2D, Orientation2D, Scale2D, and
Collider2D. For each matching entity, it calls
Collider2D.update with the collider, the entity’s position,
the angle returned by Rotary.toAngle, and the entity’s scale. An
entity missing any of these components is not updated.
import { AppSchedule } from '@wimaengine/core'
import { updateBodies } from '@wimaengine/physics'
app.registerSystem({
schedule: AppSchedule.Update,
system: updateBodies
})
// Physics2DPlugin already registers this system for its app.