drawShapes

View sourcedrawShapes(world: World): void

Draws the current Collider2D geometry on the main window canvas.

Physics2DDebuggerPlugin registers this exact function directly in the repeating AppSchedule.Update schedule when its drawShapes option is enabled. The system queries every entity with a collider and uses its current vertices rather than the collider’s original geometry. Polygon paths are closed and stroked in light green. Circle colliders use vertices[0] as the center and vertices[1].x as the radius; they also draw a radius-length orientation arm from the angle stored in shape.angle.

Before querying colliders, the system finds the entity matching MainWindow together with its EntityHandle and resolves its canvas through the Windows resource. The world must provide that main-window match and resource. A missing canvas or unavailable 2D context causes an immediate return without drawing.

Examples

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

app.registerSystem({
  schedule: AppSchedule.Update,
  system: drawShapes
})
// Physics2DDebuggerPlugin enables this overlay by default.

Parameters

NameDescriptionDefault
world

World containing Collider2D components and the main window.

—