Phong13 / BulletSharpUnity3d

A fork of the BulletSharp project to make the Bullet Physics Engine usable from C# code in Unity3d
Other
548 stars 145 forks source link

WebGL #34

Open franckmolto opened 8 years ago

franckmolto commented 8 years ago

Well, it's not exactly an issue, but it would be great to have a build for WebGL. It seems that it has already been done with pevious version of bullet, using Emscripten.

Regards

franckmolto commented 8 years ago

http://forum.unity3d.com/threads/include-native-c-code-into-webgl-build-how.307262/

asimplestd commented 2 years ago

Hi, ‘Plugins’ folder doesn’t contain WebGL entry. Do you plan to add one? The issue is old and probably something has changed since 2016. Thanks in advance!

Phong13 commented 2 years ago

I don't have plans to add a WebGL entry.

Bullet Physics is a big plugin written in pure C++ code. In theory a WebGL build can be added by adding all the Bullet Source to the il2cpp folder and Unity will magically compile it into the rest of its IL2CPP c++ code as it is being built. For WebGL this includes converting the compiled code to Javascript.

I am reluctant to try this for a few reasons: This process is different than dropping .dlls into the plugin's forlder. Also I am very skeptical that this will work. C++ is a very quirky language. High performance C++ usually does a lot of tricks with pointers that cannot be done in higher level languages like Javascript. I would be very surprised if the code worked in Javascript. Also I think the performance would be terrible. There is a good reason Bullet was written in C++ and not a high level interpreted language like Javascript.