21 releases

0.9.4 Nov 17, 2018
0.9.2 Sep 15, 2018
0.9.0 Jul 28, 2018
0.7.2 Sep 7, 2017
0.1.2 Mar 31, 2016

#8 in Science

Download history 79/week @ 2018-10-25 246/week @ 2018-11-01 235/week @ 2018-11-08 155/week @ 2018-11-15 192/week @ 2018-11-22 227/week @ 2018-11-29 170/week @ 2018-12-06 224/week @ 2018-12-13 112/week @ 2018-12-20 352/week @ 2018-12-27 205/week @ 2019-01-03 152/week @ 2019-01-10 231/week @ 2019-01-17

855 downloads per month
Used in 2 crates


12K SLoC


crates.io Build status

Users guide | 2D Documentation | 3D Documentation | Forum

 Click one of those buttons if you wish to donate to support the development of nphysics:

Become a Patron!      Donate using Liberapay


nphysics is a 2 and 3-dimensional physics engine for games and animations. It uses ncollide for collision detection, and nalgebra for vector/matrix math. 2D and 3D implementations both share the same code!

Examples are available in the examples2d and examples3d directories. Interactive 3D are available there. Because those demos are based on WASM and WebGl 1.0 they should work on most modern browsers. Feel free to ask for help and discuss features on the official user forum.

Why another physics engine?

There are a lot of physics engine out there. However having a physics engine written in Rust is much more fun than writing bindings and has several advantages:

  • It shows that Rust is suitable for soft real-time applications. − It features an efficient implementation of multibodies using the reduced-coordinates approach. Constraint-based joints are also supported.
  • It shows that there is no need to write two separate engines for 2D and 3D: genericity wrt the dimension is possible (modulo low level arithmetic specializations for each dimension).
  • In a not-that-near future, C++ will die of ugliness. Then, people will search for a physics engine and nphysics will be there, proudly exhibiting its Rusty sexiness.


You will need the latest release of the Rust compiler and the official package manager: Cargo.

If you want to use the 2D version of nphysics, add the crate named nphysics2d to your dependencies:

nphysics2d = "0.9"

For the 3D version, add the crate named nphysics3d:

nphysics3d = "0.9"


  • Static, dynamic, and kinematic rigid bodies.
  • Common convex primitives: box, ball, convex polyhedron.
  • Concave geometries built from convex primitives: compound geometries, trinangle mesh, polylines.
  • Multibodies using reduced-coordinates approaches or constraints-based joints.
  • Multibody joint limits and motors.
  • Stable stacking due to non-linear a position-based penetration correction and one-shot contact manifold generation.
  • Island based sleeping (objects deactivation when they are at rest).
  • Ray casting.
  • Sensors.
  • WASM support.

What is missing?

nphysics is a very young library and needs to learn a lot of things to become a grown up. Many missing features are because of missing features on ncollide. Features missing from nphysics itself include:

  • Breakable joints.
  • Soft-bodies.
  • Fluids.
  • Parallel pipeline.
  • GPU-based pipeline.


The libraries needed to compile the physics engine are:

  • ncollide: the collision detection library.
  • nalgebra: the linear algebra library.

The libraries needed to compile the examples are:


~76K SLoC