Generated by GPT-5-mini| Ammo.js | |
|---|---|
| Name | Ammo.js |
Ammo.js is a JavaScript/TypeScript port of a physics engine enabling rigid body dynamics, collision detection, and soft body simulation for interactive 3D applications. It brings capabilities derived from a C++ physics project into web and native ecosystems, allowing integration with graphics, game engines, and simulation frameworks. Developers use it to simulate real-time physics in browsers, desktop applications, and virtual reality environments.
Ammo.js implements physics primitives such as collision shapes, constraints, and solvers used to simulate articulated bodies, soft volumes, and vehicle dynamics. It is commonly paired with rendering engines and scene graph technologies to create immersive experiences, where deterministic stepping and stability are important for synchronization with animation systems like those in Unity (game engine), Unreal Engine, Blender, Autodesk Maya, Autodesk 3ds Max, Houdini, Cinema 4D, Godot Engine, CryEngine, Amazon Lumberyard, Source (game engine), Id Tech, Frostbite, RenderMan, Arnold (software), V-Ray, Octane Render, Redshift, KeyShot, SketchUp, Rhinoceros 3D, Revit.
Ammo.js is used across industries that adopt 3D technologies, including visual effects, architecture, robotics, and education, and interfaces with web APIs and browser runtimes such as Google Chrome, Mozilla Firefox, Apple Safari, Microsoft Edge, Node.js, Electron, NW.js, React Native, WebKit.
Ammo.js originated as a transpilation of a widely used C++ physics engine into a format suitable for JavaScript runtimes using compilation toolchains and portability projects. The porting process involved toolchains associated with Emscripten, LLVM, Clang, Binaryen, WebAssembly, and asm.js to target browsers and server-side JavaScript. Its development has been influenced by contributions from developers familiar with projects in the open-source ecosystem such as GitHub, GitLab, Bitbucket, and collaboration platforms like Stack Overflow, Mozilla Developer Network, W3C, WHATWG, Khronos Group, WebAssembly Community Group, WebGL Working Group, Open Source Initiative, Apache Software Foundation, Linux Foundation, Free Software Foundation, Creative Commons.
Historical milestones include community forks and optimization efforts inspired by performance work in Google V8, SpiderMonkey, ChakraCore, and advances in browser JavaScript JIT compilers, as well as cross-platform packaging via npm, Yarn, Bower, CDNJS, UNPKG.
Ammo.js preserves core architectural elements of the original C++ engine: a broad set of collision detectors, broadphase and narrowphase systems, constraint solvers, and memory-managed object pools. The design leverages low-level memory interfaces provided by compiled artifacts to represent rigid bodies, transforms, and collision shapes for real-time updates synchronized with render loops used by frameworks such as Three.js, Babylon.js, A-Frame, PlayCanvas, and Cesium (software).
The engine exposes APIs for creating shapes (box, sphere, capsule, convex hull), configuring motion states, and attaching constraints like hinge, point-to-point, and generic 6DoF. It interoperates with animation systems and networked simulations involving projects like WebRTC, WebSocket, Socket.IO, Colyseus, Photon Engine, Mirror (software), and integrates with data formats and pipelines including glTF, FBX, OBJ, Alembic, USD, Collada, PLY, STL.
Key features include rigid body dynamics, soft body dynamics, cloth simulation, vehicle models, continuous collision detection, and support for compound shapes and constraint chains. Performance characteristics depend on runtime optimizations in JavaScript engines and compilation targets; improvements have leveraged WebAssembly SIMD, SIMD.js proposals, multi-threading approaches via Web Workers, and experimental concurrency techniques from SharedArrayBuffer and Atomics.
Profiling and optimization often reference tooling from Chrome DevTools, Firefox Developer Tools, Safari Web Inspector, Node.js Inspector, LLDB, GDB, perf (Linux), and Instruments (macOS) for bottleneck analysis. Benchmarks compare CPU-bound steps and memory usage against native implementations and alternatives used in engines such as PhysX, Havok, Bullet (software), ODE (software), Newton Game Dynamics.
Ammo.js is accessible from JavaScript and TypeScript projects and is commonly wrapped for higher-level frameworks. Bindings and glue code provide idiomatic APIs in ecosystems including TypeScript, Flow (software), Babel, Webpack, Rollup, Parcel (software), Vite, ESBuild, Bun (software), RequireJS, SystemJS, and package registries like npm, Yarnpkg.
Integration examples span real-time engines and middleware that include Three.js, Babylon.js, A-Frame, PlayCanvas, Godot Engine, Unity (via WebGL), server-side physics using Node.js, and embedding in desktop apps through Electron and NW.js.
Common applications include game mechanics, virtual prototyping, robotics simulation, architectural visualization, interactive training, and scientific visualization. Notable workflows pair Ammo.js with scene composers, physics-based animation systems, and input frameworks such as Leap Motion, HTC Vive, Oculus Rift, Valve Index, Windows Mixed Reality, OpenXR, WebXR Device API, and motion capture pipelines that also use OptiTrack, Vicon, Kinect.
Research and industrial usage often combine Ammo.js with tools for data analysis and visualization like JupyterLab, Observable, D3.js, Plotly, TensorFlow.js, PyTorch (software), and robotic middleware such as ROS (Robot Operating System).
The project exists within an ecosystem of open-source projects and community contributions hosted on platforms such as GitHub and discussions in forums like Stack Overflow, Reddit (website), Discord (software), Gitter, Twitter, Medium (website), Dev.to, Hacker News, and professional networks including LinkedIn. Licensing and redistribution are governed by open-source licenses compatible with both web deployment and commercial integration, and contributions adhere to common practices established by organizations like Open Source Initiative and Free Software Foundation.
Category:Physics engines