A lightweight 2D physics engine in C++, built as a learning journey and passion project.
- Build the library:
./build_lib.sh - Create a demo in the
examples/src/my_demofolder and build it:./examples/build_examples.sh - Run your demo:
./build/my_demo
colliding_balls.mp4
bouncing_balls.mp4
-
Vec2(basic vector math) -
Body(circle-only: pos, vel, mass, radius) -
World(gravity + integration loop) -
DebugDraw(SFML/SDL/OpenGL) - Falling ball demo 🌕
- Rain of balls demo 🌧
- Bouncing off ground demo ⬇️
-
Shapebase class -
CircleShape,PolygonShape - Collision detection (circle–circle, polygon–polygon)
- Contact manifold
- Simple solver (impulse resolution)
- Ball pit demo ⚪
- Box stack demo 📦
- Domino chain demo 🧱
- Ball inside box demo 🏀
-
Jointbase class -
RevoluteJoint,DistanceJoint - Island solver
- Pendulum demo 🔗
- Rope bridge demo 🌉
- Ragdoll demo 🕺
- Newton’s cradle demo 🪀
- Broad-phase (dynamic tree, sweep & prune)
- Continuous collision detection (TOI)
- Bullet through stack demo 💥
- Loop track demo 🎢
- Stress test with thousands of objects 🌊
-
Particle+ParticleSystem - Particle contacts
- Water fountain demo 💧
- Sand pile demo 🏖
- Smoke effect demo ☁️
- Liquid in a box demo 🌊
-
Rope,RopeJoint -
SoftBody,Cloth - Rope swing demo 🪢
- Flag in wind demo 🏴
- Jelly cube demo 🍮
- Cloth + fluid interaction demo 🌊
- World callbacks (begin/end contact)
- Profiler & memory manager
- Mixed scene demo 🎮
- Destructible bridge demo 🏗
- Tornado effect demo 🌀
- Clothe simulation
- Fluid simulation
- Smoke simulation