drawBounds

View sourcedrawBounds(world: World): void

Draws the current PhysicsHitbox bounds on the main window canvas.

Physics2DDebuggerPlugin registers this exact function directly in the repeating AppSchedule.Update schedule when its drawBounds option is enabled. The system queries every entity with a PhysicsHitbox, then draws its min/max rectangle with a red, 3-pixel stroke. It reads the values already stored by the physics systems; it does not calculate or update the bounds.

The system finds the entity matching MainWindow together with its EntityHandle, then looks up that handle in the Windows resource. The world must provide that main-window match and resource. If the handle has no registered canvas, or the canvas cannot provide a 2D context, the function returns without drawing.

Examples

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

app.registerSystem({
  schedule: AppSchedule.Update,
  system: drawBounds
})
// Physics2DDebuggerPlugin registers this when drawBounds is enabled.

Parameters

NameDescriptionDefault
world

World containing PhysicsHitbox components and the main window.

—