{"id":15095728,"url":"https://github.com/pmndrs/cannon-es-debugger","last_synced_at":"2025-10-19T11:32:28.306Z","repository":{"id":41320957,"uuid":"271212934","full_name":"pmndrs/cannon-es-debugger","owner":"pmndrs","description":"Wireframe debugger for use with cannon-es https://github.com/react-spring/cannon-es","archived":false,"fork":false,"pushed_at":"2023-03-05T18:26:24.000Z","size":368,"stargazers_count":107,"open_issues_count":7,"forks_count":17,"subscribers_count":11,"default_branch":"master","last_synced_at":"2024-10-29T15:32:10.223Z","etag":null,"topics":["cannonjs","physics","threejs"],"latest_commit_sha":null,"homepage":"https://pmndrs.github.io/cannon-es-debugger/","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pmndrs.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2020-06-10T07:46:44.000Z","updated_at":"2024-10-25T20:40:58.000Z","dependencies_parsed_at":"2024-01-30T02:04:30.481Z","dependency_job_id":"83181feb-5d09-438a-b7c9-ab874066b436","html_url":"https://github.com/pmndrs/cannon-es-debugger","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmndrs%2Fcannon-es-debugger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmndrs%2Fcannon-es-debugger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmndrs%2Fcannon-es-debugger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmndrs%2Fcannon-es-debugger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pmndrs","download_url":"https://codeload.github.com/pmndrs/cannon-es-debugger/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237125381,"owners_count":19259277,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cannonjs","physics","threejs"],"created_at":"2024-09-25T15:41:30.942Z","updated_at":"2025-10-19T11:32:23.006Z","avatar_url":"https://github.com/pmndrs.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cannon-es-debugger\n\n[![Demo Image](https://i.imgur.com/2Bf8KfJ.png)](https://pmndrs.github.io/cannon-es-debugger/)\n\nThis is a debugger for use with [cannon-es](https://github.com/pmndrs/cannon-es). It was adapted from the [original cannon.js debugger](https://github.com/schteppe/cannon.js/blob/master/tools/threejs/CannonDebugRenderer.js) written by Stefan Hedman [@schteppe](https://github.com/schteppe).\n\n**Note:** This debugger is included in [use-cannon](https://github.com/pmndrs/use-cannon#debug) directly.\n\n### Example\n\nhttps://pmndrs.github.io/cannon-es-debugger/\n\n### Installation\n\n```\nyarn add cannon-es-debugger\n```\n\nMake sure you also have `three` and `cannon-es` as dependencies.\n\n```\nyarn add three cannon-es\n```\n\n### Usage\n\nGive `cannon-es-debugger` references to your three.js scene object and cannon-es world:\n\n```js\nimport { Scene } from 'three'\nimport { World } from 'cannon-es'\nimport CannonDebugger from 'cannon-es-debugger'\n\nconst scene = new Scene()\nconst world = new World()\nconst cannonDebugger = new CannonDebugger(scene, world, {\n  // options...\n})\n\n// ...\n\nfunction animate() {\n  requestAnimationFrame(animate)\n\n  world.step(timeStep) // Update cannon-es physics\n  cannonDebugger.update() // Update the CannonDebugger meshes\n  renderer.render(scene, camera) // Render the three.js scene\n}\nanimate()\n```\n\nNew meshes with wireframe material will be generated from your physics body shapes and added into the scene. The position of the meshes will be synched with the Cannon physics body simulation on every animation frame.\n\n### API\n\n```ts\nimport type { Scene, Color } from 'three'\nimport type { Body } from 'cannon-es'\n\ntype DebugOptions = {\n  color?: string | number | Color\n  scale?: number\n  onInit?: (body: Body, mesh: Mesh, shape: Shape) =\u003e void\n  onUpdate?: (body: Body, mesh: Mesh, shape: Shape) =\u003e void\n}\n\nexport default class CannonDebugger {\n  constructor(scene: Scene, world: World, options: DebugOptions): void\n\n  update(): void\n}\n```\n\nThe available properties of the `options` object are:\n\n- **`color`** - a [Three Color](https://threejs.org/docs/#api/en/math/Color) argument that sets the wireframe color, defaults to `0x00ff00`\n\n- **`scale`** - scale factor for all the wireframe meshes, defaults to 1\n\n- **`onInit`** - callback function that runs once, right after a new wireframe mesh is added\n\n- **`onUpdate`** - callback function that runs on every subsequent animation frame\n\nThe `update()` method needs to be called in a `requestAnimationFrame` loop to keep updating the wireframe meshes after the bodies have been updated.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpmndrs%2Fcannon-es-debugger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpmndrs%2Fcannon-es-debugger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpmndrs%2Fcannon-es-debugger/lists"}