How to load a model.json + textures from a local path on a server?

I am planning to load quite large 20mb files into a game but they can only be loaded in one at a time and then need to be destroyed due to their size when a user selects a different model. So I have to be able to find a way to load them outside of the playcanvas GUI or from Chrome console to be exact while I am developing it.
I have the playcanvas index.html file and in the same directory I have exported a scene containing a single 3d object as well as 3 texture maps. When I export that scene out containing this 3d object I get the following structure for example or something similar I forget the exact layout.


and so on.

I need to be able to load the 3d json model using Chrome console into a completely different playcanvas project along with its textures into the index.html scene and have it displayed at 0,0,0 at a scale of 1,1,1 for example. How do I do that?

Wouldn’t it be easier to host those files locally on your server? To get the absolute URL from where the assets are hosted on the server is fiddly at best. It isn’t something you can pull from the editor.

Is this from the the project page or from the publish window? (There is a difference between the two).

Yes the files are hosted locally on my server … for now I am testing with node http-server or apache depending on what I am doing. I only mention Chrome console because I do not want any explanations that are related to using the Playcanvas editor as I am not using that for code.

I export the scene like this
----- PC editor > manage scenes > publish > download ----

I am downloading the project and then inserting my own app.js into the index.html to handle the GUI side of things.

Eventually I will be connecting to AWS or Azure to load up the .json and texture assets from the users mobile device.

I am a lone dev on this at the moment so it’s a bit of a handful :smiley:

This is a quick example for loading a model but it should help give you a few hints to deal with the materials, textures, etc

1 Like

@yauster 404 not found for me on that link… is it private?

My bad, I created a project that was private by default :confused: Should be accessible now.

Thanks, that worked perfectly. :+1: