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.
Installation
yarn add cannon-es-debuggerMake sure you also have three and cannon-es as dependencies.
yarn add three cannon-esUsage
Give cannon-es-debugger references to your Three scene object and Cannon physics bodies:
import { Scene } from 'three'
import { World } from 'cannon-es'
import cannonDebugger from 'cannon-es-debugger'
const scene = new Scene()
const world = new World()
cannonDebugger(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
autoUpdate?: Boolean
}
export default function cannonDebugger(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 frameautoUpdate- wheter or not the debugger should update by itself (default:true)
If you set autoUpdate: false, then you can use the update() method included in the returned object to update the debugger manually.