There are a few different ports of Box2D for JavaScript. Which one is the best?
Box2DJS - "converted from Box2DFlashAS3_1.4.3.1 in an automatic manner"
Box2Dflash 2.0 ported to JavaScript - "one big nasty hack that just happens to work"
box2dweb - "a port of Box2DFlash 2.1a to JavaScript. I developed an ActionScript 3 -to- JavaScript converter to generate the code"
HBehrens/box2d.js - "a JavaScript Version of Box2D 2.1a" (Added Nov 21, 2011)
kripken/box2d.js - "a direct port of the Box2D 2D physics engine to JavaScript, using Emscripten" (Added Sep 24, 2013)
Any ideas which version http://chrome.angrybirds.com/ uses, if any?
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:
There's also a similar discussion on gamedev.stackexchange.com.
I'd say that the winner is kripken/box2d.js.
This question and its best answer are from 2011. One recent new option is box2.js, an Emscripten translation of the C++ code to Javascript. As of August 2013 it's more up-to-date than the other ports I've found, and the demos seem to work.
LiquidFun (With JS Bindings)
LiquidFun is, at the time I'm posting this, the most recent port to JS. It has all the features of Box2D and liquid physics features. It's ported using emscripten, so performance is decent.
google/liquidfun
google/liquidfun/tree/master/liquidfun/Box2D/lfjs
Probably the best place to keep up to date with Box2D JavaScript ports is the official forum: http://box2d.org/forum/viewforum.php?f=22
JSBox2D looks like a good start.
I would definitely have a look into Matter.js, which seems very well built and very quick. I'm going down this path. http://brm.io/matter-js
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With