DebugDraw
Draws what the physics sees, in world space, on a klyph Canvas: soft bodies filled from their outlines, and the solids they collide with. Its view adds more, a level at a time: every particle and tile edge, then every constraint coloured by its stress, then every contact and its normal (see DebugView). showBroadphase adds the broadphase's cells on top. What isn't shown costs nothing.
klyph has no polygons, so shapes are filled one row of ROW world units at a time, and lines are stretched, turned quads of pixel (App.assets.whitePixel). Labels need a font, such as App.assets.defaultFont; without one they are not drawn.
toString gives what it shows, for example DebugDraw(view=CONSTRAINTS, broadphase=false).
Properties
Whether overlay also shades the broadphase's cells and outlines its boxes.
Whether particles and tile edges are drawn: any view but DebugView.OFF.
Functions
Shades every cell of world's broadphase once per box filed there, so busy cells glow brighter, and outlines each box: one per soft body and one per colliding particle, from the world's own broadphase, and one per rigid body, from its contacts' broadphase.
Draws every constraint of world from DebugView.CONSTRAINTS up, coloured by its stress, from blue squeezed through grey at rest to red stretched: a link along its length, a pin as a line to the point it holds, an attachment as a line to its point on its rigid body, a joint as a dot on its anchor (a line to its other end for a distance joint), a bend as a dot on its middle particle, an area as a dot in its middle.
Marks, from DebugView.EVERYTHING up, every particle of world that touched something during the last step: a dot where it touched, and a short line along the normal it was pushed out by, in yellow on a floor and cyan on anything else. Every rigid body's velocity, as a line to where it will be in a tenth of a second. And every rigid contact the same way, a line the way it pushes the first body: green where friction holds it, orange where it slides, dim where it was found near but didn't push.
Draws every joint of world from DebugView.CONSTRAINTS up: a dot on its first anchor, yellow, or orange when its motor is on, a line to its second coloured by how far it's been pulled from where it should be (a slider's off its axis; a distance joint's line is its stick), and a weld's dot bigger. A hinge with limits shows them as a wedge fixed to its second end, and its first end's direction as a needle inside it; a slider shows the stretch of its axis it may slide along.
Draws every live distance and rope in constraints as a line between its particles: ropes in ropeColor.
Draws where a and b of world overlap, shape by shape, as the narrowphase finds it, in color: each point as a dot on each surface, joined, and a line along the normal. Unlike contacts, it shows bodies that pass through each other, such as a kinematic body and a static one, which never push and so have no contacts.
Draws everything view and showBroadphase ask for that a scene doesn't draw itself: constraints, contacts and broadphase. Call it after the scene, every frame.
Shows how a broadphase of cellSize sees every particle of world, each as the box it sweeps through in the next ahead: every cell a box is filed under, tinted once per box so busy cells glow brighter, and a line between the two particles of every pair that might touch. It finds them itself, so it shows particles that collide with nothing too.