A physics-based 3D orbital mechanics simulator built with Three.js and TypeScript, simulating the Apollo 11 spacecraft’s Trans-Lunar Injection (TLI) and subsequent maneuvers to reach Low Lunar Orbit (LLO).
This project blends astrodynamics, numerical integration methods, and visualization into a single simulation of one of humanity’s most iconic journeys: from Earth to the Moon.
Live at https://zaid-al-habbal.github.io/apollo-11-simulation/
- Realistic orbital mechanics using Newtonian gravitation.
- Numerical integration algorithms:
- 4th-order Runge–Kutta (RK4) for spacecraft dynamics.
- Velocity Verlet for long-term Earth–Moon orbital stability.
- Hohmann-like transfer phases:
- Trans-Lunar Injection (TLI).
- Lunar Orbit Insertion (LOI-1 and LOI-2).
- Circularization to Low Lunar Orbit (LLO).
- Δv calculations at each burn step.
- Interactive 3D visualization (Earth, Moon, spacecraft, orbital trails).
- Cinematic effects:
- Chase camera views.
- Engine burn effects with shader-based flames.
- Velocity-lock mode, camera shakes during burns.
git clone https://github.com/Zaid-Al-Habbal/apollo-11-simulation
cd apollo-11-simulationnpm installnpm run devOpen browser at http://localhost:5173
In July 1969, Apollo 11 executed a Trans-Lunar Injection (TLI) — a single long-duration burn of the S-IVB third stage — to escape Earth orbit and head toward the Moon. After coasting through cislunar space, the spacecraft performed lunar orbit insertion burns to be captured into Low Lunar Orbit (LLO).
Our simulation mirrors this mission, using simplified but physically faithful models.
The spacecraft motion is governed by Newton’s 2-body problem with perturbations:
Where:
- r = position vector.
- v = velocity vector.
- a = acceleration due to gravity, thrust, and drag (if applicable).
RK4 provides high-accuracy integration for the spacecraft state (position, velocity, mass).
At each step, we compute:
Then update:
Where y = (r, v, m) includes position, velocity, and mass.
This captures engine thrust and fuel depletion dynamics accurately during burns.
For long-term integration of Earth–Moon orbital dynamics, we use Velocity Verlet:
This method is symplectic, ensuring energy stability over long periods — ideal for planetary motion.
-
Launch & Parking Orbit
- Start in Low Earth Orbit (LEO).
-
Phase 1 – Trans-Lunar Injection (TLI)
- Burn prograde to raise apogee to lunar distance.
- Δv₁ ≈ 3.2 km/s.
-
Phase 2 – Lunar Approach
- Coast along transfer ellipse.
- Align with the Moon’s motion.
-
Phase 3 – Lunar Orbit Insertion (LOI-1)
- Retrograde burn at perilune.
- Capture into elliptical lunar orbit.
-
Phase 4 – Apolune Adjustment (LOI-2)
- Burn at apolune to lower perilune altitude.
- Shape orbit toward desired LLO.
-
Phase 5 – Circularization
- Final retrograde burn at perilune.
- Achieve Low Lunar Orbit (~100 km altitude).
-
Mission Complete!
- 3D Earth & Moon with textures.
- Spacecraft model (Saturn V 3rd stage) with orbit trail.
- Shader-based flame effects for burns.
- Bloom & glow effects for cinematic realism.
- Multiple camera modes:
- Top-down orbital view.
- Moon-centric view.
- Chase camera (follows spacecraft).
- Three.js – 3D rendering.
- TypeScript – Strong typing.
- Vite – Fast bundler.
- Lil-GUI – Parameter controls.
- Stats.js - Performance Monitor.
- Rami Sabbagh - Project Supervisor (GitHub)
- Saturn V 3D model(I removed the first and second stages) from: https://sketchfab.com/3d-models/saturn-v-nasa-7a2c9709ff8144c8b3b18ec84b5e112e
- Textures from this great website: https://www.solarsystemscope.com/textures/
- Thanks to Bobby Roe for helping me with the visualizations: https://github.com/bobbyroe
MIT License – Free for learning, teaching, and exploration.