A hobby project building a basic 2D physics engine in Rust for learning and experimentation.
Work in progress - building out core physics simulation and visualization.
- Uses uom for compile-time unit verification
- Custom
Vector2Dtype compatible withuomquantities
- Rust (latest stable)
- Python 3 (for pre-commit hooks)
# Clone the repository
git clone git@github.com:JakeLmp/rust_physics_engine.git
cd rust_physics_engine
# Set up pre-commit hooks
python3 -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements.txt
pre-commit install
# Build and run
cargo runThis project uses:
- macroquad for 2D rendering
- uom for type-safe physical units and quantities
- pre-commit with
cargo fmtandclippy(pedantic mode)
Format and lint before committing:
cargo fmt
cargo clippy --all-targets --all-features -- -W clippy::pedanticSee the documentation files in the docs/ folder for usage examples and explanations of the main types and traits:
physical_object.md: ThePhysicalObjecttrait and its implementations.point_mass.md: Creating and updating a physics point-mass object.cluster.md: Managing and simulating clusters of physical objects.vector.md: Performing vector math for physics calculations.
These documentation pages include code snippets and explanations to help you get started with simulation and visualization.
You can also find runnable simulation examples in the examples/ folder.
To run an example, use:
cargo run --example <example_name>Replace <example_name> with the name of the example file (without the .rs extension).