A physics sandbox written in Rust.
A toy project created while learning the language, graphics drawn using the piston_window
crate.
Figure 1: Particle emitters and a particle orbiting a blackhole.
piston_window requires Rust 1.47.0 To reset to a previous Rust version use rustup default 1.47.0
Simply cd
into physbox-rs
after cloning into the repo.
Then, build and run with cargo run --release
(make sure to use the release flag to build with optimisation).
-
left-click
and drag, insert an entity depending on the current insert mode: -
p
Particle insert mode, creates a particle with the drawn initial velocity vector. -
e
Emmiter insert mode, creates a particle emitter emitting particles with velocities distributed about the drawn vector. -
b
BlackHole insert mode, creates a black hole with mass proportional to the drawn radius. -
o
Obstacle insert mode, inserts static collision detecting objects (not yet implelemted). -
right-click
remove entities under the mouse pointer. -
r
remvoes all entities from the simulation. -
Space
iterates through: Global gravity {Off, Down, Up}. -
Return
toggles solid walls around the window (on by default).
Figure 2: Emitters with global gravity and containing walls enabled.
Figure 3 A two black hole system, one stripping particles from the other's orbit.
Video 1: Drawing two particle emitters and inserting a blackhole between them.
Video 2: A two black hole system, one stripping mass from the other.
Video 3: Removing black holes from a system, then introducing global gravity.