An integration of PlayCanvas with the 2D physics engine p2.js. With this integration, you get a powerful visual editing environment for your p2.js powered applications.
- Create a new project on PlayCanvas and open the Editor.
- Drag playcanvas-p2.js into the Assets panel of the Editor.
- Do the same with p2.min.js.
- Set script loading order to ensure p2.min.js is loaded first.
- Create a script component on the root entity in the Hierarchy panel and add the p2World script object.
- Create as many rigid bodies as you wish. To create a rigid body, create a new Entity and add a script component. Then add a p2Body script object. Finally assign a shape to the body by adding either a p2Box or p2Circle shape.
https://playcanvas.com/project/446127/overview/p2.js%20Integration