Skip to content

A helper class to debug draw Ammo physics world state in PlayCanvas.

License

Notifications You must be signed in to change notification settings

LeXXik/ammo-debug-drawer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

ammo-debug-drawer

A helper class to debug draw Ammo physics world state in PlayCanvas.

GitHub license

Live Demo: https://playcanv.as/p/OEVC2poo/

Project: https://playcanvas.com/project/744419/overview/ammo-debug-draw

API:

Create new renderer and enabling it:

const renderer = new AmmoDebugDrawer();
renderer.enable();

Change drawing mode:

// Following modes supported:
//      0: hide
//      1: wireframe mode
//      2: bounding boxes
//      3: wireframe + AABB
//      8: contact points
const mode = 2;
renderer.setMode(mode);

Update the drawer state (should be in your update method to run every frame):

renderer.update();

Optionally, you can target specific layer for drawing. Internally defaults to layer Debug Draw and falls back to UI, if not found.

const layer = app.scene.layers.getLayerByName('My Layer');
const renderer = new AmmoDebugDrawer(layer);

Disable drawer:

renderer.disable();

About

A helper class to debug draw Ammo physics world state in PlayCanvas.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published