Skip to content

KineticTactic/orbits

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Orbits! - A Newtonian Gravity Sandbox

Orbits! is a 2D gravity simulation built in C++ using raylib. It simulates Newtonian gravitational interactions between multiple bodies and visualizes their motion and orbital paths in real time. It uses Velocity Verlet integration for stable, energy-preserving orbits.

orbits

Controls

  • Left Click Drag to add a body and set its velocity. Scroll to change the mass of the body.
  • Right Click Drag to pan the view.
  • Scroll to zoom in and out.
  • Space to pause the simulation.

Touch controls:

  • Use buttons for selecting modes.
  • In PAN mode, drag to pan the view and pinch to zoom.
  • In ADD mode, tap to add a body and drag to set its velocity. Pinch to change the mass of the body.

Building

Use CMake to build the project. Raylib is automatically downloaded and built as a dependency.

mkdir build
cmake -B build -S . # -G "MinGW Makefiles"
cmake --build build	 # or make or mingw32-make

orbits.exe will be created in the build directory.

Building for WebAssembly

To build the project for WebAssembly, you need to use the Emscripten toolchain. First, make sure you have Emscripten installed and set up correctly. Then, you can create a build using the following commands:

mkdir buildweb
emcmake cmake -B buildweb -S .
cmake --build buildweb

emrun --no_browser --port 8080 buildweb/index.html # to run the server

This will generate a WebAssembly version of the project that can be run in a web browser.

About

2D newtonian gravity sandbox.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published