A C++ articulated body physics engine for interactive demos and experiments.
Implements RNEA (Recursive Newton–Euler Algorithm) and CRBA (Composite Rigid Body Algorithm), as described in Rigid Body Dynamics Algorithms by Featherstone, at the core of the solver.
Supports closed-loop systems using simple joints as loop-closure constraints. Loop closure is enforced at the acceleration level, with Baumgarte-stabilized velocity and position terms.
Supports coupling across joints and degrees of freedom by modeling coupling as linear constraints between DoFs. Constraints are resolved by parameterizing joint accelerations using the orthogonal complement basis of the constraint matrix.
Solves contacts using an impulse-based approach, implementing Projected Gauss–Seidel (PGS) with Sequential Impulses (SI) and impulse warm starting. Impulses transmitted across loop-closure joints are also accounted for during collision handling.
Solves spring forces using a semi-implicit Euler integration scheme, improving numerical stability and preventing blow-up for stiff springs.
Streamlines physics asset creation and the simulation pipeline by supporting construction of a physics world from glTF physics assets exported from Blender.
| Joint Type | Dynamics Model | Support Loop Closure | Support Spring |
|---|---|---|---|
| Revolute | Motion subspace | ✅ | ✅ |
| Prismatic | Motion subspace | ✅ | ✅ |
| Cylindrical | Motion subspace | ✅ | ✅ *both DoFs |
| Spherical | Motion subspace | ✅ | ❌ |
| Gear | Coupling 2 revolutes | ❌ | ✅ *both joints |
| Rack and Pinion | Coupling a revolute and a prismatic | ❌ | ✅ *both joints |
| Screw | Coupling the 2 DoFs of a cylindrical | ❌ | ✅ *both DoFs |
| Worm | Coupling linear DoF of a cylindrical and a revolute | ❌ | ✅ *all DoFs and joints |
- A spring cannot be applied to a joint when the joint is a loop closure.
What each of these demos demonstrates
-
BulletCollision, Bullet v3.25
Only the collision detection components are used. Collision resolution is implemented separately within this project.
Refer tothird_party/bulletfor build instructions. -
Eigen v3.4.0
Used for core Featherstone dynamics. -
glm v1.0.1
Used alongside raylib for rendering utilities. -
glTF_Physics_Blender_Exporter v0.5.4
Install this exporter in Blender if you need to generate physics-enabled assets.
Note that there are certain limitations and caveats in the asset generation process. These will either be resolved in future updates or documented separately in an instruction guide.glTF Physics is not an official feature supported by the glTF specification.
The following CMake cache variables must be specified if the libraries are not installed system-wide:
EIGEN3_INCLUDE_DIR— Path to the Eigen include directoryGLM_INCLUDE_DIR— Path to the GLM include directory
cmake -DEIGEN3_INCLUDE_DIR=[your Eigen directory] -DGLM_INCLUDE_DIR=[your GLM directory] .. -G "Visual Studio 17 2022"
- Windows 10 / Visual Studio 2022
- Expand joint types (e.g., fixed joints, 6-DoF joints)
- Inverse dynamics and inverse kinematics for more sophisticated control
- Contact block solver for improved convergence and performance
- Coulomb friction formulated as a linear complementarity problem (LCP)
- Joint limits with impulse-based enforcement
- Rotational friction models at contact points
- CCD (Continuous Collision Detection)






