AbstractDraw a capsule outline (two semicircles connected by straight segments). Used for: static/kinematic capsule shapes.
Draw a circle outline. Used for: static/kinematic circle shapes.
World-space centre.
Circle radius.
Optionalcolour: numberOptional ARGB colour hint.
Draw a point marker. Used for: contact points, centre-of-mass markers.
World-space position.
Optionalcolour: numberOptional ARGB colour hint.
Draw a polygon outline. Used for: static/kinematic polygon shapes.
World-space vertices in order. Do NOT store this array.
Optionalcolour: numberOptional ARGB colour hint.
Draw a line segment between two world-space points. Used for: polygon edges, velocity vectors, joint lines, AABB edges.
Draw a filled circle with an orientation indicator segment.
Used for: dynamic circle shapes. The axis segment shows body rotation.
Draw a filled polygon. Used for: dynamic polygon shapes.
World-space vertices in order. Do NOT store this array.
Optionalcolour: numberOptional ARGB colour hint.
Abstract interface for debug rendering of a physics space.
Implement this class and pass an instance to
Space.debugDraw()to visualise the physics world — shapes, joints, contacts, AABBs, velocities, and centre-of-mass markers — using any 2D rendering backend (Canvas 2D, PixiJS, p5.js, Three.js, etc.).None of the methods are abstract by language enforcement — they all default to no-ops so you can override only the primitives your renderer needs.
Example