Add realistic rigid-body physics to a browser-based 3D game so objects fall, collide, and bounce under gravity.
Run cloth, rope, or soft-body simulations in a web browser without a server-side physics engine.
Prototype a vehicle simulation with suspension and wheel friction that runs entirely in the browser.
Use ammo.js with Three.js or Babylon.js to synchronize visual objects with physics simulation positions.
A prebuilt ammo.js file is included in the repo under builds/ so most users don't need to compile anything, building from source requires Emscripten and cmake.
Ammo.js is a version of the Bullet physics engine that runs inside a web browser. Bullet is a well-established physics simulation library written in C++, used in games and 3D applications to simulate how objects fall, collide, bounce, and interact with forces. Normally Bullet runs as native compiled code on a desktop or console. Ammo.js makes the same physics engine available to JavaScript developers by translating the C++ source code into JavaScript automatically using a tool called Emscripten, rather than rewriting it by hand. The name is an acronym: Avoided Making My Own js physics engine by compiling bullet from C++. Because the translation is automated rather than hand-written, the API closely mirrors the original Bullet API. JavaScript developers access physics objects through an Ammo namespace: for example, creating a vector is done with new Ammo.btVector3(x, y, z). Struct member variables that would be directly readable in C++ are accessed through getter and setter functions in the JavaScript version. The library ships with both a standard JavaScript build and a WebAssembly build, which is a more compact binary format that browsers can load and execute faster. The project includes several live browser demos covering common physics scenarios: a stack of cubes colliding under gravity, a rope, cloth, a soft volume, a height-mapped terrain, and a vehicle simulation. These demonstrate what Bullet can do and give developers concrete examples to reference. A prebuilt version of ammo.js is included in the repository under the builds directory, so most developers can start using it without compiling anything themselves. For those who want to build from source, the process requires Emscripten and cmake. A Docker-based build path is also available. Build size can be reduced by removing unused interfaces from the interface definition file. Ammo.js is licensed under the zlib license, the same license as Bullet. It is used most often by developers building 3D games or simulations that run in the browser and need realistic physics without writing a physics engine themselves.
← kripken on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.