Crate nphysics2d [] [src]


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. There is also a short (outdated) demonstration video. An on-line version of this documentation is available here. 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:


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.1.*"

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

nphysics3d = "0.1.*"

Use make examples to build the demos and execute ./your_favorite_example_here --help to see all the cool stuffs you can do.


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:


All dependencies are automatically cloned with a recursive clone. The libraries needed to compile the physics engine are:

The libraries needed to compile the examples are:



Aliases for complicated parameterized types.


Collision detection and joints.


Position and orientation update of rigid bodies.


Compilation flags dependent aliases for mathematical types.


Objects that may be added to the physical world.


Constraint resolution.


Miscellaneous utilities.


Volume and inertia tensor computation.


The physics world.