Package Exports
- cannon-es-debugger
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (cannon-es-debugger) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme

This is a debugger for use with cannon-es. It was adapted from the original cannon.js debugger written by Stefan Hedman @schteppe.
Note: This debugger currently does not work with use-cannon.
Usage
Give cannon-es-debugger references to your Three scene object and Cannon physics bodies:
import { Scene } from 'three'
import { World } from 'cannon-es'
import debug from 'cannon-es-debugger'
const scene = new Scene()
const world = new World()
debug(scene, world.bodies, options)New meshes with wireframe textures will be generated from your physics body geometries and added into the scene. A mesh will be created for every shape in the physics body. The position of the meshes will be synched with the Cannon physics body simulation on every animation frame.
API
The available properties of the options object are listed below.
import type { Scene, Color } from 'three'
import type { Body } from 'cannon-es'
type DebugOptions = {
color?: string | number | Color,
onInit?: (body: Body, mesh: Mesh, shape: Shape) => void,
onUpdate?: (body: Body, mesh: Mesh, shape: Shape) => void,
}
export default function renderWireframes (scene: Scene, bodies: Body[], options: DebugOptions): voidcolor- a Three Color argument that sets the wireframe color, defaults to0x00ff00onInit- callback function that runs once, right after a new wireframe mesh is addedonUpdate- callback function that runs on every subsequent animation frame