agilgur5 / physijs-webpack

PhysiJS port for bundlers with out-of-the-box support for Webpack and Browserify
Other
9 stars 3 forks source link

Fix Browserify Integration #5

Closed agilgur5 closed 5 years ago

agilgur5 commented 5 years ago

This PR resolves #2 and replaces #3 . It also adds a test for certainty, resolving #4 as well (at least on the Browserify side). I don't have a project I could even test it out in (hence the issue in the first place), so a test is very helpful. Will also pave the way forward for more tests, CI, etc.

A lot of work went into bugfixing/trial-and-erroring the webworkify integration as well as setting up the test harness correctly to support al the browser nuances necessary to get the code to even run.

agilgur5 commented 5 years ago

@mpaccione if you could test this PR/branch in your project (npm i -S agilgur5/physijs-webpack#browserify-fix) that would be super helpful!

I've added a test here, but it's quite small. I think it should be good enough but not really sure what surface area the tests should actually capture for an accurate baseline (don't want to be testing PhysiJS itself). If you could confirm that this test is enough and that the browserify integration is now working, that would add some more certainty.

mpaccione commented 5 years ago

@agilgur5 Okay this runs! Physijs.Scene() executes without error.

agilgur5 commented 5 years ago

Physijs.Scene() executes without error.

@mpaccione have you used any other PhysiJS objects in your project yet? Or just creating the scene so far? Because correct creation of Physijs.Scene(...) is also the one and only thing the tests actually cover 😅

mpaccione commented 5 years ago

@agilgur5 Haha, yes I have used Box Meshes and Materials with Friction values and such with no logged error :)

I emailed chandler, the creator of Physijs about the continued maintenance of the library. He currently has no intention of maintaining it :( He was open to someone else doing that though ha!

Right now, my next big challenge is to investigate the possibility of integrating BufferGeometry support into the library. I have large (massive) planes for the landscape and standard plane geometries require too much memory / can crash the browser.

agilgur5 commented 5 years ago

@agilgur5 Haha, yes I have used Box Meshes and Materials with Friction values and such with no logged error :)

Great! Will merge this in in a bit :) Thanks for the help!

I emailed chandler, the creator of Physijs about the continued maintenance of the library. He currently has no intention of maintaining it :( He was open to someone else doing that though ha!

I'm kinda surprised he even responded, been a while since it got an update and v2 which uses GoblinPhysics never got merged in. He upvoted my comment when I got this library to work so I guess he occasionally has an eye on it. PhysiJS isn't altogether that huge at 3k LoC, but the possible surface area for features is much larger and it's pretty complex because physics. The Three integration is also painful, though hopefully Three might become more modularized, pluggable, and SemVer compatible at some point -- all react-three projects have issues with it as well 😕

I have large (massive) planes for the landscape and standard plane geometries require too much memory / can crash the browser.

😅 yea that sounds tough. LTLMoPWeb3D had some pretty simple Three & Physijs integrations, but it spikes CPU and memory hard (it also runs its own simulation loop and can have even more workers for ROS integration, but I believe it was spiking even before both of those existed). I'm curious if Unity's in-browser performance differs

agilgur5 commented 5 years ago

Released as v0.1.2