Matter.js
A JavaScript 2D rigid body physics engine for the web. Part of Open-source motion studio: 20 repos.
Checked 2026-10-27 against the GitHub repository, its README, and the npm or PyPI registry where relevant.
| Runtime | Browser and Node.js; CPU only. |
| How an agent drives it | Library API in code. A physics step can be advanced manually, which makes frame-by-frame replay possible; confirm determinism for your own scenes before relying on it. |
| License | MIT. |
| Maintenance | Latest npm release 0.20.0 (2024-06-23); GitHub shows no formal release but a 0.20.0 tag; repo pushed 2026-09-30; not archived. Release cadence is slow. |
What it gives you
- Features listed in the README: rigid, compound and composite bodies, concave and convex hulls, physical properties (mass, density, restitution), collisions, constraints and plugins.
- Input: bodies and constraints defined in code. Output: positions and angles per step, which you draw yourself; a built-in renderer exists for debugging.
Key differentiator
The long-standing, widely used JavaScript 2D engine with a friendly API and a plugin set. Source: README gallery and feature list.
Pick something else when
Planck.js (a Box2D port, MIT, npm 1.5.1 modified 2026-10-12) for Box2D behaviour. Rapier for 3D or for a fast WASM build. Jolt or cannon-es for 3D. See the physics comparison.
Agent fit
Moderate. Good for stacking and collision effects that an agent scripts, if the host steps time itself.
Overlap with the rest of the stack
2D counterpart to Rapier (which also has a 2D crate).