Generated by GPT-5-mini| Cannon.js | |
|---|---|
| Name | Cannon.js |
| Author | Unknown |
| Developer | Community |
| Released | 2011 |
| Latest release | (varies) |
| Programming language | JavaScript |
| Platform | Web, Node.js |
| License | MIT |
Cannon.js is an open-source JavaScript physics engine designed for rigid body simulation in 3D environments used in web browsers and server-side JavaScript. It provides collision detection, constraints, and numerical solvers to model physical interactions for applications ranging from interactive graphics to scientific visualization. The project interacts with numerous libraries and platforms in the JavaScript ecosystem and has been referenced alongside notable projects and institutions in web and game development.
Cannon.js implements rigid body dynamics, collision detection, and constraint solvers to simulate physical systems alongside Mozilla, Google, Apple web technologies and rendering libraries such as Three.js, Babylon.js, PixiJS, WebGL, Canvas (HTML element), Node.js, Electron (software), React (web framework), Angular (web framework), Vue.js, Deno (software runtime), Chrome (web browser), Firefox, Safari, Microsoft Edge. The engine exposes APIs for shapes, bodies, materials, and contact resolution used by developers at organizations like Epic Games, Unity Technologies, Valve Corporation, Blizzard Entertainment, Naughty Dog for prototyping and educational projects at institutions such as MIT, Stanford University, UC Berkeley, Carnegie Mellon University. Implementations commonly pair Cannon.js with model formats and tools including glTF, OBJ (geometry definition file format), FBX, Blender, Maya (software), 3ds Max and physics-oriented datasets used in research at Google Research, OpenAI, DeepMind.
Cannon.js emerged in the early 2010s amid growth of web standards fostered by organizations like WHATWG, W3C, ECMA International and developer communities around GitHub, Stack Overflow, npm (software) and jsdelivr. Contributions came from independent developers and companies leveraging collaborative workflows inspired by projects such as Box2D, Bullet (physics engine), ODE (software), PhysX, Havok (company), and scholarly work from research groups at CMU, ETH Zurich, University of Tokyo. Over time the codebase saw forks and maintenance by volunteers, mirroring governance patterns seen in Linux kernel, Apache HTTP Server, Node.js Foundation projects and being discussed in conferences like JSConf, SIGGRAPH, GDC.
The architecture centers on modular constructs—bodies, shapes, materials, contacts, constraints, and solvers—paralleling designs from Bullet (physics engine), Havok (company), PhysX. Collision detection uses broadphase and narrowphase strategies similar to those in NVIDIA, Intel research, and supports primitives such as spheres, boxes, convex polyhedra, cylinders, and heightfields compatible with scene graphs used by Three.js and Babylon.js. Constraint types include point-to-point, hinge, and distance constraints influenced by formulations in papers from SIGGRAPH authors and labs like MIT CSAIL and Stanford AI Lab. Numerical integration schemes borrow from classical methods popularized by textbooks from Isaac Newton-era formulations and modern treatments at Courant Institute curricula.
Developers integrate Cannon.js with rendering engines such as Three.js, Babylon.js, A-Frame, and frameworks like React (web framework), Vue.js to construct interactive applications deployed via GitHub Pages, Netlify, Vercel (company), or packaged into desktop apps with Electron (software). Common workflows import meshes from glTF exporters in Blender or Maya (software) and map collision shapes in pipelines similar to those used by teams at Epic Games and Unity Technologies. Server-side simulations run on Node.js or Deno (software) for headless batch processing in research projects affiliated with OpenAI and DeepMind.
Performance characteristics depend on algorithmic choices and JavaScript execution in engines developed by Google V8, Mozilla SpiderMonkey, Apple JavaScriptCore and are subject to single-threaded constraints of the event loop as discussed by Brendan Eich and platform architects at Mozilla. Compared to engines like Bullet (physics engine) and PhysX, Cannon.js favors simplicity and ease of use, trading off advanced features such as continuous collision detection, GPU-accelerated solvers from NVIDIA, or deterministic multi-threaded simulation found in Havok (company). Numerical stability, timestep management, and contact resolution require tuning akin to practices recommended in papers from SIGGRAPH and courses at UC Berkeley.
Cannon.js has been used in education projects at MIT, interactive visualizations by media labs such as MIT Media Lab, prototypes at studios like Blizzard Entertainment and Valve Corporation, browser-based games showcased at js13kGames, and research demos affiliated with Stanford University and CMU. Example applications include ragdoll physics for character demos inspired by techniques from SIGGRAPH proceedings, vehicle dynamics prototypes referencing work from SAE International publications, and architectural simulations used in conjunction with tools like AutoCAD, Rhino (software), and Grasshopper (software).
The project is distributed under the MIT License, encouraging reuse by companies and academic groups such as Google Research, OpenAI, DeepMind, Unity Technologies, Epic Games, and hobbyist communities on GitHub, GitLab, Stack Overflow, Reddit (website). Community activity follows models seen in open-source ecosystems like Linux kernel and Apache Software Foundation projects, with contributions coordinated through issue trackers, pull requests, and discussions at conferences including JSConf and FOSDEM.
Category:Physics engines