Skip to content

Add cinematic interactive spacecraft trajectory simulator - #5

Open
Copilot wants to merge 1 commit into
mainfrom
copilot/spacecraft-trajectory-simulator
Open

Add cinematic interactive spacecraft trajectory simulator#5
Copilot wants to merge 1 commit into
mainfrom
copilot/spacecraft-trajectory-simulator

Conversation

Copilot AI commented Aug 6, 2026

Copy link
Copy Markdown

Summary

Adds a standalone, dependency-free HTML/JS spacecraft trajectory simulator at public/spacecraft-trajectory-simulator.html. Just open the file in a browser \u2014 no build step needed.

Features

  • Physics: simplified 2D gravitational simulation (Terra + orbiting moon Luna), rocket-equation-style fuel burn, orbital element prediction (apoapsis/periapsis/eccentricity)
  • Missions: Orbital Insertion, Lunar Transfer, Deep Space Escape, and a Free Flight sandbox, selectable from the title screen
  • Controls: rotate (A/D), prograde/retrograde thrust (W/S), full throttle (Shift), cut throttle (X), time warp (pause/1x/5x/20x/100x via , / . or buttons), camera cycle (C: chase/system/free with scroll-zoom and drag-pan)
  • Cinematic presentation: parallax twinkling starfield, glowing planet/star bodies, thruster exhaust particles, explosion FX on impact, dashed predicted-orbit ellipse, prograde velocity marker, smooth eased camera, vignette/scanline overlay, animated title card
  • HUD: live telemetry (altitude, velocity, apoapsis/periapsis, heading, throttle, fuel), mission clock, flight event log, and full-screen success/failure overlays

Verification

Exercised headlessly via Chrome + Puppeteer:

  • Confirmed zero console/page errors across all 4 missions
  • Verified orbital insertion success path (stable circular orbit detection)
  • Verified lunar transfer and escape-trajectory detection
  • Verified mission-failure path: rotated ship, retrograde-burned into Terra, confirmed impact detection, explosion particles, and "Mission Failure" overlay render correctly
  • Fixed a bug where physics ran before mission start, causing an instant false "landed" event at T+0 (added a missionStarted gate)
  • Fixed a display bug showing negative periapsis on impact-course trajectories (now shows "Impact course")

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

Standalone HTML/JS demo (public/spacecraft-trajectory-simulator.html):
- Simplified 2D gravitational simulation (Terra + orbiting Luna)
- 4 selectable missions: orbital insertion, lunar transfer, deep space
  escape, and free flight sandbox
- Full flight controls: rotate, prograde/retrograde thrust, throttle,
  time warp (pause/1x/5x/20x/100x)
- Cinematic rendering: parallax starfield, glowing planet bodies,
  thruster particle trails, predicted orbit ellipse, velocity vector
  marker, chase/system/free camera modes with smooth easing and zoom
- Live HUD telemetry (altitude, velocity, apoapsis/periapsis, fuel,
  throttle, mission clock) plus flight log and success/failure overlays
- No external dependencies; runs by opening the file directly in a browser

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant