updateBounds

View sourceupdateBounds(world: World): void

Rebuilds each queried entity’s axis-aligned PhysicsHitbox from its current world-space Collider2D.

Physics2DPlugin registers this function directly in the repeating AppSchedule.Update schedule when autoUpdateBounds is enabled. The query requires both components, so entities without either a collider or a hitbox are skipped.

Circle colliders use vertices[0] as the center and the x and y values of vertices[1] as the radii. Other colliders derive their bounds by visiting every vertex. The system updates the existing min and max vectors on each PhysicsHitbox in place; it does not replace the component or calculate bounds from transforms itself.

Examples

import { AppSchedule } from '@wimaengine/core'
import { updateBounds } from '@wimaengine/physics'

// Physics2DPlugin registers this automatically unless autoUpdateBounds is
// disabled. Custom pipelines can register it directly:
app.registerSystem({
  schedule: AppSchedule.Update,
  system: updateBounds
})

Parameters

NameDescriptionDefault
world——