nphysics

Join us on Discord CircleCI Crates.io Status License (3-Clause BSD)

Become a Patron!


2D and 3D real-time physics engine

… for the Rust programming language.


Rigid-body simulations with contacts  
Setup a physics world to simulate rigid solids with external forces and contacts. Includes dynamic, static, and kinematic rigid bodies, as well as colliders for collision detection.
Joint constraints and multibodies  
Constrain the relative motion of two bodies either using forces (with joint constraints) or by reducing their relative degrees of freedom (with multibodies).
Deformable bodies simulation  
Simulate deformable bodies that can interact with all other kinds of bodies implemented in nphysics. The computation of deformation is either based on a mass-spring system or a finite-element method.
Contact models  
Choose the appropriate contact model to achieve the desired level of accuracy and performance. Included are the Signorini and an approximate Signorini-Coulomb contact models.
Interaction handling and sensors  
Retrieve collision events to apply logic depending on the interaction between objects. Use a special type of collider, sensors, which won’t interact physically with other objects but will generate proximity events.
Continuous collision detection  
Don’t miss any contact by enabling continuous collision detection (CCD) on any collider. Prevent the tunneling problem between fast-moving bodies, and don’t miss any proximity event thanks to full CCD support on sensors.
Accuracy and performance tuning  
Choose the right compromise between accuracy and performance for your application.
The nphysics testbed  
Setup a physical scene and use the nphysics_testbed2d or nphysics_testbed3d crate to display and interact with it.
WASM compatibility  
Use nphysics on a project expected to run on a web browser.