Physics Engine
NAME
physics-engine - Physics Engine
SYNOPSIS
Rigid-body sphere physics in C++20 with an OpenGL viewer.
DESCRIPTION
Spheres fall, bounce, slide, roll, and collide with restitution and Coulomb friction. Friction at the contact point creates torque, so a sliding ball spins up and settles into rolling on its own.
Every result is checked against a closed-form answer in the test suite.
STACK
C++20, OpenGL, GLSL, GLM, CMake, Catch2
HIGHLIGHTS
- Sequential-impulse solver with accumulated impulse clamping and a friction cone
- Exponential-map quaternion integration so rotation doesn't drift at high spin
- Shared contact point conserves angular momentum to machine precision
- Tests for free fall, bounce height, the 5/7 slide-to-roll speed, momentum conservation, and bitwise determinism
- Custom GLSL vertex and fragment shaders for real-time rendering