Which Box2D JavaScript library should I use? [closed]

Note to readers!

This question was originally asked and answered in 2011, but I’ll do my best to keep it up to date!

Here’s what I’ve found:

  • kripken/box2d.js is a port of Box2D using Emscripten and works well and is fast. I have used this personally with great success.
  • planck.js is the newest port and is written from the ground-up in JavaScript
  • Box2DJS is a port of Box2DFlash 1.4.3.1. box2dweb is a port of version 2.1a.
  • Box2DJS works “as a CommonJS module without any modifications at all” [1]
  • Box2DJS “not up-to-date and you have to import a big amount of JavaScript files in every project” [2]
  • box2dweb is contained in a single file [2]
  • box2dweb is “a much newer port and has a lot fewer issues” than Box2DJS [3]. However, switching might introduce new issues [4].
  • Box2DJS depends on Prototype but box2dweb does not [5]
  • Seth Ladd has promoted box2dweb with examples on his blog [6]
  • Nobody seems to be using the third alternative.
  • There are also physics simulators not based on Box2D. Check out Matter.js and p2.js

There’s also a similar discussion on gamedev.stackexchange.com.

I’d say that the winner is kripken/box2d.js.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)