THREE-XPBD icon indicating copy to clipboard operation
THREE-XPBD copied to clipboard

XPBD physics in THREE.js

THREE.js feat. XPBD physics 🌈

Based on Extended Position Based Dynamics by Matthias Müller.

Refer to the docs directory to view the papers and source code used in this project.

Demo: https://markeasting.github.io/three/

Development

npm install - Install dependencies

npm run dev - Runs the local dev server

npm run build - Build the project

Features

Core

  • [x] XPBD update loop
  • [x] XPBD World / body manager
  • [x] Rigid bodies
  • [x] Body 'sleep' feature
  • [x] applyForce()
  • [ ] applyTorque()

Collision solver

  • [x] Penetration
  • [x] Surface properties: friction & restitution
  • [x] Broad phase (AABB)
  • [x] Narrow phase (GJK / EPA)
  • [x] Convex hull generation
  • [x] Contact manifold generation / clipping algorithm
  • [ ] Broad phase (sorting algorithm)
  • [ ] Broad phase (spatial subdivision / octree)
  • [ ] Narrow phase (optimized primitives: spheres, capsules)
  • [ ] Object pool for Vec3 instances

Constraints

  • [x] Basic constraint
  • [x] Mouse picking/dragging
  • [x] Calculate constraint force
  • [x] Damping
  • [ ] Swing / twist limits