Skip to content

nicknagi/rust-physics-simulation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust Physics Simulation

A simple physics simulation built with Rust. Goal of the project was to learn basic rust while doing something fun.

How To Run

Simply download the binary from the releases tab and run!

If you would rather compile yourself, then run cargo build --release from the project root.

Implementation

Implementation is not the most efficient but works well up to 10000 particles.

Collision detection: a simple collision detection algorithm is used to find and resolve collisions. Approach similar to sweep and prune is used for speed.

Forces: Arbitrary forces can be applied and resolved on each particles, feel free to edit the code to experiment. The current implementation includes gravitational attraction as an example. A constant force such as gravity (g) can also be applied by modifying line 125.

Demo

collision_simple.mov
collisions_gravity.mov
collisions_constant_acceleration.mov

About

Particle physics simulation in Rust

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages