raw-physics, a simple rigid body physics engine created with XPBD

Post Reply
felipekersting
Posts: 4
Joined: Sat Jan 08, 2022 9:08 pm

raw-physics, a simple rigid body physics engine created with XPBD

Post by felipekersting »

raw-physics is a project that I have been working during the past few months.

https://github.com/felipeek/raw-physics

It is a rigid body physics simulator powered by XPBD for collision response and GJK+EPA for collision detection. Specifically:

Collision Response: All of the collision response is handled by XPBD. The algorithm is based on this work by Mathias Muller et all, published in 2020: https://matthias-research.github.io/pag ... Bodies.pdf. The beauty of this work is that it presents a XPBD algorithm specific for rigid bodies such that the algorithm (and the constraints) directly takes into account rigid-body properties such as the angular velocity, inertia tensor, etc. Hinge joints and spherical joints are easily integrated as constraints and I also implemented in my engine.

Collision Detection: For collision detection, I used GJK+EPA for convex shapes with Sutherland-Hodgman for clipping the contacts and generating the collision manifold. It worked really well with XPBD! I also implemented dedicated collision detectors for spheres.

The simplicity of XPBD allows the generation of very interesting visual results with very little code, it is really amazing. I show some examples in the README.

This project is not meant to be a full engine that can be directly integrated in a big project, but rather a small project showing how these pieces can be integrated and serving as a small reference.

Some examples are presented in the README. It is also very easy to build yourself and see some examples (build instructions in README. ESC to open the menu)

I hope you find it useful!
Post Reply