2D physics engine written in Rust.
Usage: Demo application using macroquad
Rust:
VSC:
- rust-analyzer - Improved Rust language support for VSC.
- CodeLLDB - Native debugger powered by LLDB.
- crates - Dependency manager for Cargo.
Body Types:
-
Supported:
- Circle
- Axis Aligned Bounding Boxes (AABB)
- Oriented Bounding Boxes (OBB) (modelled as Polygons)
- Convex Polygons
-
Not supported:
- Concave Polygons
- The engine checks for concave polygons and panics when it detects one.
- But if the polygon edges intersect one another the polygons do not get detected as concave even though they are, but this is easy to detect visually and should not be done.
- Concave Polygons
The engine uses a "homemade" collision detection approach, where each shape combination is checked explicitly.
Most parts of the engine are optimized to some extend, both memory and runtime wise. Nevertheless, there still is much room for possible improvements and optimizations, specifically:
- Utilizing multiple cores in the collision pipeline.
- Using a QuadTree for the collision broad phase.
- Restricting world bounds; currently unlimited (f32::MAX)
- Implementing continuos collision detection (CCD).
- ...
As this is a passion project, the engine has no implementation timeline etc. Future functionality will be add whenever I feel like it.
- Box2D-lite
- Impulse Engine
- Collision Response by Chris Hecker
- and various other articles & papers on physics engines!