An object-oriented 2D solar system simulation built in Processing for a school project. This simulation models gravitational interactions, orbital motion, and collisions between celestial bodies — demonstrating key OOP principles, physics logic, and scalable simulation design.
- 🌍 Realistic orbital motion and gravitational pull
- ☄️ Collision detection and fusion logic for asteroids and planets
- 🔭 Auto-scaling camera that keeps all objects in frame
- 🪐 Customizable scenarios (e.g., solar system, binary stars, supernova events)
- 🧩 Fully object-oriented structure for modular and extensible code
/CelestialBodies
│
├── CelestialBodies.pde # Main Processing sketch (entry point)
├── Camera.pde # Handles camera scaling and center-of-mass tracking
├── CelestialDynamics.pde # Core physics logic and gravity calculations
├── HelperFunctions.pde # Utility functions (collision effects, drawing helpers)
└── Scenerios.pde # Manages scenario data and celestial configurations
---
## 🛠️ How to Run
1. Install **[Processing](https://processing.org/download/)**.
2. Clone this repository:
```bash
git clone https://github.com/deepakawicked/OOP-Solar-System.git
- Open
Simulation.pdein Processing. - Click Run
▶️ to start the simulation.
- Add new bodies by creating subclasses of
Celestial. - Modify parameters like mass, velocity, or position.
- Adjust camera padding and time steps in
autoScaleCamera()for smoother zooming. - Experiment with
Scenario.javato create unique systems.
- Created for a school project to demonstrate object-oriented programming and basic physics simulation.
- Physics are simplified for visualization and learning purposes.
- Free to modify, fork, and expand upon.
This project is released under the MIT License. Feel free to use, modify, or learn from it.