Getting started

warning

This documentation is still work-in-progress. It may contain some incomplete or outdated information.

Installing Rapier from NPM

Rapier is available as the @dimforge/rapier2d and @dimforge/rapier3d NPM packages. You may add the following to your package.json:

"dependencies": {
"@dimforge/rapier2d": "^0.2.0",
}

Because Rapier is actually a WebAssembly module, it has to be loaded asynchronously:

import('@dimforge/rapier2d').then(RAPIER => {
// Use the RAPIER module here.
})

See the testbed3d/src/demos and testbed2d/src/demos folders for examples on how to initialize a Rapier physics world using these bindings.