Video: https://www.youtube.com/watch?v=g-xs6bY9a7s
Objects in Space Simulator (OSS) is a 2D physics-based space simulator that allows users to create and experiment with custom planetary systems. Users can place planets, modify physical properties, and observe how gravitational forces affect motion in real time.
- JavaScript, HTML, and CSS
- Konva.js
- Python
- Flask
OSS allows users to select planets or the Sun from a built-in object library and drag them into the simulation space. Each object can be customized by changing its mass, radius, velocity, and direction. Once the system is set up, users can start the simulation and watch orbital paths, flybys, and gravitational interactions unfold based on physics calculations.
Users can play and pause the simulation at any time, remove objects, or quickly start with preconfigured layouts to explore different scenarios.
The inspiration for this project came from viewing NASA websites that display real-time planetary data. While those visualizations were impressive, we wanted to explore what would happen if the system could be modified. OSS was created to allow users to freely change positions, masses, and velocities and observe how physics determines the outcome.
The frontend was built using Konva.js to handle 2D rendering, animations, and user interaction. The backend was written in Python to perform gravitational physics calculations. Flask was used to connect the frontend and backend, allowing object data and position updates to be exchanged in real time.
To run the backend locally, follow these steps.
cd backend python -m venv venv .\venv\Scripts\activate pip install -r requirements.txt flask run
cd backend python3 -m venv venv source venv/bin/activate pip install -r requirements.txt python app.py
Then run the index.html file