JoltPhysics.js
This project enables using Jolt Physics in JavaScript.
Demos
- Falling Shapes Demo - Shows supported shape types.
- Constraints Demo - Shows supported constraint types.
- Stress Test Demo - Shows big pile of blocks.
Using
The library comes in 2 flavours: a JavaScript version and a WASM version. See falling_shapes.html for an example on how to use the library.
Not all of the Jolt interface has been exposed yet. If you need something, just add it to JoltJS.idl and JoltJS.h and send a pull request.
Building
This project has only been compiled under Linux.
- Install emscripten and ensure that its environment variables have been setup
- Install cmake
- Run
./build.sh
for the optimized build or./build.sh Debug
for the debug build
Running
By default the examples use the WASM version of Jolt. This requires serving the html file using a web server rather than opening the html file directly. Use e.g. serve to quickly host the file.
If you need to debug the C++ code take a look at WASM debugging.
Credits
This project was started from the Ammo.js code, but little remains of it as the Jolt Physics API is very different from the Bullet API.
License
The project is distributed under the MIT license.