Skip to content

markeasting/THREE-XPBD

Repository files navigation

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

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

Collision solver

  • Penetration
  • Surface properties: friction & restitution
  • Broad phase (AABB)
  • Narrow phase (GJK / EPA)
  • Convex hull generation
  • 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

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