Skip to content

Add a Box3D Physics page to the community extensions - #1629

Merged
Popov72 merged 2 commits into
BabylonJS:masterfrom
Pryme8:box3d-physics-extension
Sep 19, 2026
Merged

Popov72 merged 2 commits into
BabylonJS:masterfrom
Pryme8:box3d-physics-extension

Conversation

@Pryme8

@Pryme8 Pryme8 commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Adds a community extension page for babylon-box3d, which brings Box3D (Erin Catto's 3D successor to Box2D v3, MIT) to Babylon.js as an IPhysicsEnginePluginV2 implementation. Scenes written for the Havok plugin run on it unchanged: PhysicsAggregate, PhysicsBody, shapes, constraints, events and ray casts.

The extension is published on npm as babylon-box3d and the repository carries the tests and the benchmark harness the page's numbers come from.

The page covers:

  • installation, the bundler locateFile case, script tags and a complete Playground scene
  • an optional threaded build that runs a world step across worker threads on a cross origin isolated page, with the same results at any worker count
  • the Box3D specific extras: explosions, wheel joints, parallel joints, collision groups, rolling resistance
  • measured step times against Havok and Oimo, with the caveats stated next to them (Havok's own world step is faster in the piles, threads cost more than they save on small scenes, and the pyramid rows are about stability rather than the clock)

configuration/structure.json gets the matching entry, alphabetically inside communityExtensions.

🤖 Generated with Claude Code

babylon-box3d is Erin Catto's Box3D compiled to WebAssembly behind a physics v2 plugin, so scenes written for the
Havok plugin run on it unchanged. The page covers installation, the script tag and Playground routes, an optional
threaded build, the Box3D specific extras, and measured numbers against Havok and Oimo with the caveats that go
with them.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

@Popov72 Popov72 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The page is valuable and the benchmark data matches the repository results, but the copy/paste setup paths and compatibility wording need correction before merging.

Comment thread content/communityExtensions/box3dPhysics.md
Comment thread content/communityExtensions/box3dPhysics.md Outdated
Comment thread content/communityExtensions/box3dPhysics.md Outdated
Comment thread content/communityExtensions/box3dPhysics.md Outdated
Review follow up:

- The npm example imports @babylonjs/core/Physics/joinedPhysicsEngineComponent, which is what registers
  scene.enablePhysics in Babylon 9, and says what goes wrong without it.
- The script tag example no longer uses top level await, which is a syntax error in a classic script.
- The introduction claims support for most of the Physics V2 API rather than everything, and a new Limitations
  section lists what differs: the character controller, mesh and height field shapes on static and animated bodies,
  convex hull and cylinder approximations, how SixDoF constraints map onto Box3D's joints, what COLLISION_CONTINUED
  reports, and the Havok only shape and proximity queries.
- The Playground example builds the benchmark's own scene, the 2D pyramid of 210 unit boxes at 20 rows with the
  same ground, friction, restitution and 1 tonne boxes, so it matches the table below it.

Both snippets were run verbatim in a browser against the published CDN files.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Pryme8 added a commit to Pryme8/babylon-box3d that referenced this pull request Sep 18, 2026
The review on BabylonJS/Documentation#1629 found the same problems here: the script tag example used top level await,
a syntax error in a classic script; the npm examples left out the joinedPhysicsEngineComponent import that registers
scene.enablePhysics in Babylon 9; the introduction promised everything written for Havok would work unchanged; and the
Playground example called a 3D pyramid of 2870 boxes the benchmark scene. The documentation page is synced from the
reviewed branch, and the README gets the same fixes.

The README also answers a question from the forum: it runs without npm or a build step, from three downloaded files
next to the page, the same way Havok's UMD build does, and needs a static server for the same reason Havok does.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@Popov72

Popov72 commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@bjsplat

bjsplat commented Sep 18, 2026

Copy link
Copy Markdown

@Popov72
Popov72 merged commit fc9e518 into BabylonJS:master Sep 19, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants