https://github.com/wendtpiotr/solar-system-gravitional-forces-simulation
A real-time simulation of planets, moons, and orbital mechanics using Newtonian physics and N-body gravitational interactions.
https://github.com/wendtpiotr/solar-system-gravitional-forces-simulation
game-development gravity nbody-gravity-simulation newton physics physics-simulation planets science solar-system
Last synced: 3 days ago
JSON representation
A real-time simulation of planets, moons, and orbital mechanics using Newtonian physics and N-body gravitational interactions.
- Host: GitHub
- URL: https://github.com/wendtpiotr/solar-system-gravitional-forces-simulation
- Owner: wendtpiotr
- License: mit
- Created: 2025-10-21T11:14:16.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2025-10-21T11:44:46.000Z (9 months ago)
- Last Synced: 2026-04-22T08:41:33.587Z (3 months ago)
- Topics: game-development, gravity, nbody-gravity-simulation, newton, physics, physics-simulation, planets, science, solar-system
- Language: C#
- Homepage:
- Size: 60.6 MB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 🌌 Physics-Based Solar System Simulation
*A **real-time simulation** of planets, moons, and orbital mechanics using **Newtonian physics** and **N-body gravitational interactions**.*
---
## 🔬 Scientific Overview
This Unity project simulates celestial bodies based on **physics-based formulas**. It solves the **N-body problem** in real-time, allowing you to:
- ✅ Calculate **mutual gravitational forces** between multiple bodies
- ✅ Predict **orbital paths** using **Euler integration**
- ✅ Visualize **runtime orbit predictions** dynamically
- ✅ Customize **planet and moon parameters**, including mass, radius, and initial velocity
This system is ideal for **educational demonstrations**, research visualizations, or exploring classical mechanics phenomena such as **Mercury’s orbital precession**.
---
## 🌟 Key Features
### Physics-Based Simulation
- Implements Newton’s law of universal gravitation:

- Computes **gravitational acceleration** between all bodies at each timestep.
- Updates **velocities and positions** in real-time using **Euler integration**.
- Supports **multiple interacting bodies**, including planets, moons, and artificial objects.
### **2. Orbit Prediction**
- Predicts **future trajectories** for each body.
- Visualizes predicted orbits with **LineRenderer**.
- Supports **individual body preview** or **all-body orbit display**.
### **3. Runtime Simulation**
- Bodies move in real-time according to **physical forces**.
- Adjustable **timeScale** to simulate faster or slower motion.
- Works in both **Editor** and **Build** for consistent results.
### **4. Customizable Bodies**
- Configure **mass, radius, initial velocity**, and parent-child relationships (for moons).
- Moons automatically inherit **parent planet velocity** if assigned.
- Orbit trails can be assigned **distinct vibrant colors** for clarity.
---
## 🎬 Example Scenes
### 🌞 Solar System
Full solar system simulation with planets and orbit prediction.

### 🌑 Two Moons
Realtime simulation of a planet with two moons showing gravitational interactions.

### ☿ Mercury Precession
Demonstrates **precession of Mercury’s orbit** due to gravitational perturbations.

---
## âš¡ Getting Started
### **Requirements**
- Unity 2020.3 or higher
- Compatible with both **Editor** and **Build** environments
### **Installation**
```bash
git clone https://github.com/yourusername/PhysicsSolarSystem.git