explaingit

isaac-mason/box3d.js

Analysis updated 2026-05-18

68C++Audience · developerComplexity · 2/5Setup · easy

TLDR

WebAssembly bindings for Erin Catto's box3d physics engine, giving JavaScript and TypeScript projects a fast 3D rigid body simulator.

Mindmap

mindmap
  root((box3d.js))
    What it does
      Wasm physics bindings
      Mirrors box3d C API
      Many live examples
    Tech stack
      C plus plus
      WebAssembly
      TypeScript
    Use cases
      Browser rigid body physics
      Ragdoll and character
      Continuous collision
    Audience
      Game developers
      Web developers
      Physics tinkerers

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Add rigid body physics, like stacking, collisions, and joints, to a browser-based 3D scene.

USE CASE 2

Prototype physics features by browsing the repo's large set of live interactive examples.

USE CASE 3

Use continuous collision detection to keep fast-moving objects from tunneling through walls.

USE CASE 4

Build a ragdoll or simple character controller on top of the box3d rigid body engine.

What is it built with?

C++WebAssemblyEmscriptenTypeScriptJavaScript

How does it compare?

isaac-mason/box3d.jspondot/liquiddx115ec1cff/injectrc
Stars687065
LanguageC++C++C++
Setup difficultyeasymoderatehard
Complexity2/54/54/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min

In plain English

box3d.js is a set of WebAssembly bindings for box3d, Erin Catto's 3D rigid body physics engine, compiled with Emscripten and packaged as an ES module with full TypeScript definitions. The JavaScript API mirrors the underlying C API function for function, using names like b3CreateWorld and b3World_Step, so the upstream box3d documentation and sample code carry over fairly directly to this package. Installation is a single npm install box3d.js command. The package offers four different build variants depending on where it runs: a single-file inline build for browsers that avoids serving a separate .wasm file, a standard build for Node.js or bundlers that can serve .wasm assets themselves, and multithreaded versions of both, with the browser multithreaded build requiring cross-origin isolation to be enabled on the page. The README is largely a gallery of live, clickable browser examples that demonstrate specific physics features: basic shapes, a heap of falling cubes, object stacking, restitution and friction, a conveyor belt, continuous collision detection for fast-moving objects, gravity scaling per body, linear and angular damping, applying an impulse at a specific position, collision filtering, joints, a ragdoll, a simple character controller, static compound shapes, triangle mesh colliders, procedural mesh generation, ray and shape casting, a hinge motor, GJK distance queries, contact manifolds, a dynamic bounding volume tree, and an explosion effect. Each example links to a hosted demo page on the project's GitHub Pages site. The full README is longer than what was shown.

Copy-paste prompts

Prompt 1
npm install box3d.js
Prompt 2
Explain how the JavaScript API in box3d.js maps to the underlying box3d C functions like b3CreateWorld.
Prompt 3
Which build of box3d.js should I import for a browser app with cross-origin isolation enabled?
Prompt 4
Show me how to set up a basic falling-cubes scene using box3d.js.

Frequently asked questions

What is box3d.js?

WebAssembly bindings for Erin Catto's box3d physics engine, giving JavaScript and TypeScript projects a fast 3D rigid body simulator.

What language is box3d.js written in?

Mainly C++. The stack also includes C++, WebAssembly, Emscripten.

How hard is box3d.js to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is box3d.js for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.