Skip to content

For-The-Wolf/physbox-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

physbox-rs

A physics sandbox written in Rust.

A toy project created while learning the language, graphics drawn using the piston_window crate.

Orbits

Figure 1: Particle emitters and a particle orbiting a blackhole.

Building

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).

Controls

  • 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).

Some examples

Fountains

Figure 2: Emitters with global gravity and containing walls enabled.

Tidal Stripping

Figure 3 A two black hole system, one stripping particles from the other's orbit.

Video 1

Video 1: Drawing two particle emitters and inserting a blackhole between them.

Video 12

Video 2: A two black hole system, one stripping mass from the other.

Video 3

Video 3: Removing black holes from a system, then introducing global gravity.

About

A physics sandbox written in Rust.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages