N-body simulation using bevy and bigbang crates
Go to file
Tyler Hallada a31fdb296b
Add disclaimer to README
This repo is now linked pretty prominently on awesome-bevy 👀
2020-10-31 15:45:01 -04:00
.cargo Initial commit, working, but w/ transparency issue 2020-08-12 00:53:26 -04:00
assets Update README with controls and new screenshot 2020-08-13 00:27:50 -04:00
src Add pause/resume control 2020-08-13 11:02:41 -04:00
.gitignore Initial commit, working, but w/ transparency issue 2020-08-12 00:53:26 -04:00
Cargo.lock Add command-line options with argh 2020-08-13 00:52:08 -04:00
Cargo.toml Add command-line options with argh 2020-08-13 00:52:08 -04:00
README.md Add disclaimer to README 2020-10-31 15:45:01 -04:00

bevy-nbody

An N-body simulation in Rust using the bevy crate for rendering and bigbang crate for the n-body calculations.

screenshot youtube video

Note: I made this shortly after bevy was initially released so it's a bit out of date now. Also, I haven't really worked with ECS before, so you probably shouldn't use this as an example of how to structure a bevy game.

Install

Clone the repo, and run cargo build --release. The executable will be under target/release/.

Usage

Usage: bevy-nbody [-n <num-bodies>] [-t <time-step>] [-w <width>] [-h <height>] [-s <scale>]

n-body simulation in bevy using bigbang

Options:
  -n, --num-bodies  number of bodies in the simulation
  -t, --time-step   granularity of simulation (how much each frame impacts
                    movement)
  -w, --width       initial width of spawned window
  -h, --height      initial height of spawned window
  -s, --scale       initial scale of view (bigger = more zoomed out)
  --help            display usage information

Controls

key control
R reset the simulation
Space pause / resume the simulation
Left Click hold and move mouse to pan the view
Middle Click hold and move mouse up and down to zoom in and out
Right Click click on a body to focus the camera on that body