Skip to content

CodeByBryant/Black-Hole-Simulation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Black Hole Simulation

Watch objects orbit, collide, and get sucked into a black hole—all in real-time 3D with interactive controls.

Made with C++ OpenGL License


Quick Start

Simply run:

./run.sh

The script will build everything and launch the simulation automatically.

How to Use It

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

What's Inside

├── src/           # The actual code
├── shaders/       # Graphics effects
├── imgui/         # User interface library
├── include/       # Header files
└── CMakeLists.txt # Build configuration

How It Works

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.

What It Doesn't Do (Yet)

  • 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)

Want to Help?

Found a bug or have an idea? Pull requests and issues are welcome!

License

MIT License - see LICENSE for details.

About

A cool black hole simulation built in c++.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Contributors 2

  •  
  •