Box3D Physics Plugin

Been posting a lot lately but its mainly because I have a ton of stuff that is just sitting with nobody looking at it or using it, so I decided its time to be more vocal.

Anyways why would you want to use this over Havok? Simple! Its hands down faster, smaller package, has a few more features and is deterministic. Oh yeah and it has multithreading support!

Just look at these numbers. They should speak for themselves.

You work with it just like you would any other v2 Physics in BJS, it just slips right in.

Check it out and mess with it when you get a chance!

7 Likes

Wow that’s great! Performance improvement using thread looks good.

1 thing that could be tried to gain even more performance is to limit the number of calls between JS and wasm. Like a an update function that returns an array of translation/orientation in a float32array. then a JS function would read that and do an update in a single loop. I’m not sure this applies to every call but it’s worth trying if you have the framework to profile it.

@srzerbetto has added a layer to batch calls into a command queue for the USD importer and the speed factor was impressive.

Could Box3D run stand alone (downloadable version), like Havok?. I mean, Havok can work just with the umd and wasm files downloaded in same folder, a script call from the html file and th Physics engine call from the javascript file (no node running). Running stand alone is a must for me.

Yes aboslutly it could!

Where may I download the files needed? Search in the link you posted, but no download link to try and test.

The UMD build works without Node — grab `box3d.umd.js`, `box3d.umd.wasm`, and `babylon.box3d.min.js` from unpkg or the npm tarball, drop them next to the HTML, and load via script tags, but it must be served over http rather than file:// since wasm fetches fail from local file access, same limitation as Havok.

Thanks. I’ll try and come back if tested.

I think that’s what the SharedBufferArray is doing. It’s the only reason the threading works.