Since Playcanvas has moved to the new method of importing Ammo in the physics section of settings, I am having issues when downloading my project for self-hosting.
I do not need to import a custom version of Ammo for this project and I am happy to use the legacy version. The physics in the project work perfectly when testing in Playcanvas but when I download the project for self-hosting as I usually do, I am getting an error as shown below in the JS console.
October 17, 2019, 10:12am
Short term fix is to grab the legacy version yourself from GitHub and include it within the html
Okay, that’s what I was thinking of doing, thanks!. This must be a known issue?
October 17, 2019, 10:27am
We definitely don’t want this! Please could you explain precisely the steps I can to replicate this issue?
Come to think of it, I reckon this error would only occur if you are directly calling the Ammo API in a script.
Create a project where the “enable physics” checkbox is not visible.
Click “Import Ammo”
Add code into your project that directly calls the Ammo API such as the Raycast vehicle script or a constraints script (hinges, point to point etc)
Download the project for self-hosting.
Create a HTML page for the project you downloaded.
Serve HTML page over server.
Check console for errors
Hope that helps!
October 17, 2019, 1:28pm
I just tested using this vehicle physics demo
https://playcanvas.com/project/644223. It worked fine.
Can I confirm you receive no other errors when you run published game? For example, the server must deliver wasm files with mime type ‘application/wasm’ else the browser will fail to load it correctly.
Looking at that project, I can see that the “enable physics” checkbox is visible, it looks like you forked that project from a project that used the legacy physics import system.
Also, I can confirm that I wasn’t writing any different code to deliver as WASM. However, this had been working pre-legacy.
Yes those are the only errors.
On top of that, I’m not sure what could be different.
October 17, 2019, 2:27pm
Sorry you’re right. This time I started from scratch and apply an impulse during script initialize:
This doesn’t result in error for me either.
October 17, 2019, 2:29pm
If possible could you give me access to your failing project or alternatively just a cutdown version that demonstrates the issue?
Thanks for you help on this!
This project throws a 404
See if you can replicate issue with this
If not, perhaps I am just missing something…
October 17, 2019, 4:00pm
This project fails even when launching from the editor.
Looks like line 202:
this.graphics.chassis = this.entity.findByName(‘ARM_Buggy’);
returns null because the object has been renamed and so later on when chassis is accessed the following output appears:
‘TypeError: Cannot read property ‘setPosition’ of null’
Yeah I know that, I copied the code from the other project you sent.
I’ll take a look again.
October 17, 2019, 4:29pm
That works for me.
To confirm, I do ‘Download build and host it on your own server’, extract the zip then navigate to index.html through my local server.
Is it possible your local server is caching files?
Yep that is exactly it.
It’s possible regarding the caching, if I run into the issue again, I will let you know.