Physics + Collisions not functioning after destroying and reloading
Description
In my engine only application we may create and destroy instances as we switch between different experiences. However on entering a second time all rigidbodies and collisions no longer function and appear to be stuck at 0,0 or missing entirely. This is despite calling app.destroy() and ensuring all local data is correctly cleaned up.
Upon further investigation I have discovered it is due to the following properties being created in "module scope". This means they PERSIST between different apps even when destroyed! I would very much appreciate it if you guys could review all module scope properties as its potentially very dangerous.
on first load:

on second load:

I have done the following workaround to fix the bug temporarily

I believe it goes wrong due to the following functions not resetting correctly (theres a few of them)?

I haven't been able to get a simple example together that shows the issue but hopefully my explanation above is enough to formulate a correct fix.
@willeastcott Any ideas on this one?
maybe it would be enough to change this line in rigid-body/component.js ?
if (typeof Ammo !== 'undefined' && !ammoTransform) {
to
if (typeof Ammo !== 'undefined') {
Sounds reasonable to me @mvaligursky
I might be late here for a comment, but if we overwrite a scoped varibale here with a new object instance of Ammo, wouldn't the old instance remain in Wasm? Those would need to be Ammo.destroy'ed somewhere.
It's true @LeXXik - I guess I converted a real issue into a small issue .. but it'd be nice to eventually fix it too. I'll leave the ticket opened.