Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm working on a web-based 3D FPS game using WebGL, HTML5 and JavaScript. It is supposed to target PCs and net-books with WebGL-enabled browsers installed.

I'm wondering if there's an existing open source 3D physics engine written in JavaScript?

share|improve this question

closed as not constructive by Sean Middleditch, bummzack, Byte56, Sam Hocevar, Josh Petrie Mar 6 '13 at 16:12

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

6 Answers 6

up vote 10 down vote accepted

There are a couple both jiglib and bullet have been ported but it's still very early days. See http://www.jiglibjs.org and http://pl4n3.blogspot.com/2010/11/webglbulletjs-demo.html

share|improve this answer
    
really nice answer :) –  Deyaa Nov 9 '10 at 8:53

Have a look at ammo.js: https://github.com/kripken/ammo.js/. It is a port of the Bullet Physics engine.

There is also a demo repository for it here: http://schteppe.github.com/ammo.js-demos/. It might help you get started.

share|improve this answer

I don't know about any 3D physics-engine implemented in JavaScript. But maybe you could have a look at the Quake2 > HTML5 port and look how they did it: http://code.google.com/p/quake2-gwt-port/

From what I understood, they used the Google Web Toolkit (GWT) to compile Java-Sources to JavaScript. I think this approach may have some benefits for your project as well, since it's much more likely that you'll find a good 3D physics-engine for Java than for JavaScript.

share|improve this answer

I would take a look at Three.js

I've used it in a couple of projects and works quite well. It also has nice documentation.

Three.js

share|improve this answer
    
Three.js is a graphics library, nothing to do with 3d physics by itself. –  Tapio Dec 27 '12 at 12:10

While personally I use ammo.js (see schteppe's answer) through Physijs wrapper, I'd also like to mention cannon.js, which is specifically created for JavaScript, unlike ammo.js, which is automatically compiled from C++ to JS. The downside is much less features in cannon.js.

JigLibJS which was mentioned by Paul Brunt appears to be unmaintained.

share|improve this answer

cannon.js. It's much faster than ammo.js because it was written in native JS instead of being ported from C++. Unfortunately, its documentation is pretty much nonexistent.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.