An open API service indexing awesome lists of open source software.

https://github.com/astrogeekdk/starship-simulator

A Starship Simulator and Game written for the Web in Three.js
https://github.com/astrogeekdk/starship-simulator

game rocket simulator threejs

Last synced: about 1 month ago
JSON representation

A Starship Simulator and Game written for the Web in Three.js

Awesome Lists containing this project

README

          

# Rocket Launch Simulator

A nice little physics-based rocket launch simulation built using Three.js and Cannon.js - that runs on the browser!

The rocket model I used is SpaceX's iconic Starship - which I am so obsessed with - those 33 Raptors!

This simulator features a realistic launch sequence, gravitational dynamics, thrust vectoring, stage separation, Return-to-Launch-Site (RTLS) and in progress Mechazilla catch capabilities.

Here is a sneak peek, tell me it isn't beautiful !?

![Starship in Orbit](./simulator.png)

## Overview

This simulator 'replicates' the dynamics of a launch-to-orbit mission, with gravitational force modeling, thrust vectoring, and control Systems to achieve realistic flight behavior.

An 8K high-resolution Earth texture, a real Milky Way starmap, a nice Starship model (credits pending), and even an particle system for thrust visualization have been used!

### Features
- **Cannon.js** physics engine
- **Rendering** with Three.js, with an 8K Earth texture, a real Milky Way starmap, and a Starship model.
- **Gravitational Model**: Implementation of gravitational force to simulate realistic orbital mechanics.
- **Thrust Vectoring**: Simulated via `applyLocalForce` at the booster's base
- **Particle Effects**: Thrust visualization using particle systems.
- **Control Systems**: Basic algorithms for attitude control and trajectory changes.

## Launch Sequence
1. **Launch**: Full thrust is applied via `applyLocalForce` at the booster's base, simulating the combined output of 33 Raptor engines.
2. **Slow Coasting** via `applyLocalForce(0, slowCoastForce, mainThrust)`
3. **Stage Separation**: At approximately 60 km altitude separating Starship from the Super Heavy Booster.
4. **Starship Orbit Insertion**: Simulated using $`F = m \frac{\Delta v}{\Delta t}`$ to achieve orbital velocity, with basic control system for nose alignment along the velocity vector.
5. **Booster Boostback Burn**: Used quaternion 'slerp' ;) for booster reorientation and descent (for now!)
6. **Return-to-Launch-Site (RTLS) and Catch**: In progress!

## Accuracy and Realism

Tried to make it super real! So used real parameters:
- **Masses**: Super Heavy Booster at 3000 metric tons (fully fueled), Starship at 2000 metric tons (fully fueled).
- **Thrust**: Simulated a total of 70,000 kN thrust - total from 33 Raptors!
- Scaled the 3d models so as to match ~120m height
- Even added a model of launch tower
- Added 4 different cameras
- Slider to change the simulation speed