Thursday, August 11, 2011

Rewritten Physics Engine Demo

Initial testing of ammo.js (a port of Bullet Physics to JavaScript using Emscripten) found some issues, but they have been quickly resolved. ammo.js should be ready for use now.

Completing that allowed me to rewrite the original Emscripten Bullet demo using ammo.js. That is, the original demo code - creating the scene and so forth - was written in C++, and was compiled alongside Bullet into JavaScript for the original demo. What I did now was to write the scene generating code in JavaScript, where it uses Bullet through ammo.js's autogenerated bindings. Check out the demo here, and read the JavaScript embedded in the HTML file to see a complete example of using ammo.js.

I'm very happy with the result: The JavaScript code in the demo is very nice to work with now, and in addition it outperforms the original demo due to build system improvements that were completed since the original demo was finished.

2 comments:

  1. Which browsers should support this? I tried Opera 11.50 and Chrome 12.0.742.112 on windows, but it says 'No WebGL support'

    ReplyDelete
  2. @Amber:

    I believe Opera still doesn't support WebGL.

    Latest Chrome stable is 13, I think? That should support WebGL. However, it (like Firefox) has a list of acceptable drivers. Perhaps updating your graphics drivers would help.

    ReplyDelete