p2-es

p2-es is a JavaScript 2D rigid body physics engine

p2-es is a 2D rigid body physics engine written in JavaScript. Features include:

  • Collision detection
  • Contacts
  • Friction and restitution
  • Motors
  • Springs
  • Advanced constraints
  • Gravity
  • Body sleeping
  • Various shape types
  • Events

This is a maintained fork of p2.js, originally created by Stefan Hedman @schteppe. It is a type-safe flatbundle (esm and cjs) which allows for tree shaking and usage in modern environments.

Examples

Examples showing how to use p2-es with your favorite renderer.

Canvas

PixiJS

DOM

Demos

These demos use the p2 Demo framework, which provides rendering and interactivity.