Watch objects orbit, collide, and get sucked into a black hole—all in real-time 3D with interactive controls.
Simply run:
./run.shThe script will build everything and launch the simulation automatically.
Camera:
- Click and drag the left mouse button to rotate your view
- Right click and drag to move the camera around
- Scroll to zoom in and out
- Press ESC to quit
Add Objects:
- Use the on-screen menu to create objects with custom:
- Position and velocity (where it starts and how fast it moves)
- Mass (affects gravity)
- Size and color
- Optional glow effect
Simulation Controls:
- Pause/resume the simulation
- Speed it up or slow it down (0.1x to 5.0x)
- Clear all objects and start fresh
├── src/ # The actual code
├── shaders/ # Graphics effects
├── imgui/ # User interface library
├── include/ # Header files
└── CMakeLists.txt # Build configuration
The simulation uses real Newtonian gravity to calculate how objects move. Objects orbit the black hole, and if they get too close to the event horizon (the point of no return), they disappear. Everything is rendered with OpenGL for smooth, real-time animation.
- It's using simplified physics, not full Einstein's General Relativity
- Only non-rotating black holes are supported
- Can't save or load simulations
- No collisions between objects (they pass through each other)
Found a bug or have an idea? Pull requests and issues are welcome!
MIT License - see LICENSE for details.