[SOLVED] [ENGINE ONLY] Scene loading error when physics is loaded

Hi I got this error when loading a scene only when physics is used:

Any idea appreciated…

Thank you!

@iso74 Is it possible to share this project so others can have a look?

Its a Vue.js app. No editor involved…

@iso74 Sorry I guess I should read the title a little better next time. So can you track down this setValue variable? I don’t have a good reference on where it is undefined. Are you starting with an example from the github repository

or here


Looks like you haven’t loaded Ammo (the library we use for physics simulation).

See the engine examples for physics on this: PlayCanvas Examples

1 Like

Ammo has been loaded using this code:

Is it done before the engine is loaded?

If you still having issues, can you post an example via GitHub or similar please?

Well it is definetly somthing with loading order and when the app starts, we discussed this already several times on the forum. When I do app.start() in moduleLoaded callback it works, but some other issues still remain. But again one step further. Thanks! When I am finally done all of this will be on Github for the community

I am curious how I can load Ammo during app.preload()? I load it manually as a Vue component.

Hmm, I am not familiar with Vue much, unfortunately, but when you say you are loading it manually, then I assume you are compiling the Wasm module manually and instantiating Ammo instance? If so, then you can use the callback to know when to start PlayCanvas, e.g.

WebAssembly.instantiateStreaming(wasm, importObject).then( /* start PC */ );

Ah no no, I am using the (new) PlayCanvas WasmModule as mentioned above (I waited long time for this in the engine, very cool). But when I looked at the PlayCanvas app lifecycle and when you publish from Editor it is marked as preload, and I asume it is not when I load a module manually. That’s why no preload event is fired then I assume…

If you can post a repro now in GitHub, we would be able to help a lot easier. Right now, there’s a lot of back and forth of ‘are you doing X’? when it is easier to just see it :slight_smile:

I just solved this issues - was as I thought a mixture of when load what and the reactive nature of Vue.js
As told if all goes well I will put everything on Github for all.

And for me sometimes it’s difficult to explain the issues correctly, that causes back and forth.


1 Like