I'm new to GL stuff (coming in via WebGL, with no direct OpenGL experience). Can we use PhysX with WebGL?
1 Answer
$\begingroup$
$\endgroup$
3
PhysX is a C++ API and can thus not directly be integrated with the JavaScript-based WebGL.
Depending on your needs, you have the following options:
- Use a JavaScript-based physics engine, mostly suitable for 2D use cases.
- Use a Game Engine that can export for the web (e.g. Unity 3D) and build your application in there, using full 3D physics capability. Keep in mind that this will probably require your users to install some additional Web Player and is not native WebGL.
Keep in mind that Game Engines may be a viable way for 2D applications too and can make your life a whole lot easier.
-
$\begingroup$ Unity can export to WebGL. $\endgroup$ Commented Aug 26, 2016 at 14:34
-
$\begingroup$ Why are JavaScript-based physics engines "mostly suitable for 2D use cases"? Also you said "Keep in mind that Game Engines may be a viable way for 2D applications too and can make your life a whole lot easier", which is why I'm making github.com/infamous/infamous (renaming it soon and adding docs/demos). It's a 3D API that currently renders to DOM (CSS3D with my DOMMatrix polyfill), and I'd like to add WebGL soon. Here's a couple small demos: trusktr.io (hover on the left edge for the 3D menu) and mightydevs.com (letters moving into formation, needs word wrapping). $\endgroup$– trusktrCommented Aug 28, 2016 at 0:53
-
$\begingroup$ @trusktr Because, or at least that's what I thought, there is no JS 3D physics engine that comes close to PhysX in terms of features. Then again I just found out that someone ported Bullet to JS. YMMV. $\endgroup$ Commented Aug 28, 2016 at 15:47