GLB - is it possible to make it run in PlayCanvas together with animations and assets(skins, etc.)

Hi all,

First time poster and new to PlayCanvas.

I am currently looking for a way for PlayCanvas to run our models together with its assets(skin, etc.) via URL. I currently have a script running in the model of the scene called “loadGlbUrl”, which gets the GLB file from “glbIPFSAsset” -

https://ipfs.io/ipfs/QmVWgxQnPT21K6nXSSmosmYRcgfhwBNAMHfsouo5dCNEZ6?filename=BabyElephant_GLB.glb

The link also shows the final product I want to see.

Will it be possible to run the GLB file directly from PlayCanvas via URL instead of linking it to a third-party site? If not, will it be possible to do this without a URL?

Here are the pertinent links:

Scene:

https://playcanvas.com/editor/scene/1299996

Code:

  • Specifically in the new folder: “glb-utils.js” and “load-glb-url.js”

Thanks for the help. I’ve tried looking through the forums but couldn’t find a way to resolve the issue. I’d be happy to read any documentation on this.

Hi @spike_bump and Welcome!

Yes it is definitely possible to load glb files in Playcanvas, there are two ways to do that, one is to load from a Url and the other is to upload the glb file to the editor and load it as binary asset. You can also load and run animations. You can check out this project as it loads animations as well

https://playcanvas.com/editor/scene/1325504

2 Likes

What’s the difference between a URL and a third party site?

Hi Yaustar,

Sorry for the confusion. I am looking for a way for the scene to launch without the aid of a third party link.
I was directed to use this example as reference →

PlayCanvas Examples

Apologies as I might have deleted it form the post since I can only include 2 links per question. Using the code, I am looking into loading one of our GLB files that currently sits in Playcanvas. Unfortunately, I can’t seem to find the URL for our Playcanvas scenes to load it here:

image

I tried to use one of our glb via third party link (https://ipfs.io/ipfs/QmVWgxQnPT21K6nXSSmosmYRcgfhwBNAMHfsouo5dCNEZ6?filename=BabyElephant_GLB.glb) and although it seems to be getting the files, it is still not loading, since it returns asset.resource as undefined when declaring this:

const entity = asset.resource.instantiateRenderEntity();

But that might be because of the loaded glb file and I know at least it is connecting since it appears when I console log it.

At this point, I am trying to get the GLB loader sample to work for our scenes in PlayCanvas. Is there a way for the code to point to something inside Playcanvas and load it?

I tried putting the URL of my project directly in the code:

GLB test 2 | Editor (playcanvas.com)

but the sample code still coudln’t load my glb file.

You could have the GLB as part of the project, is that what you mean?

Here is an example from your other thread that I forked and loads from URL and from a GLB binary asset. Are either of these what you want?

https://playcanvas.com/editor/scene/1370241

Code is taken from this tutorial sample: Loading glTF GLBs | Learn PlayCanvas

Hi Yaustar,

Thank you for this. I think I can articulate better now what I want to happen after looking around Playcanvas -

I want to make a showcase of my playcanvas projects via HTML, similar to the tutorial page.

i.e. (

)

HTML/CSS - Live Updates | Learn PlayCanvas

How do I load the launch URL to my HTML like this? Looking at the HTML/CSS page, it launches the project in a window inside an HTML for users to interact with. Is there a specific way on how I can do this?

Let me know and thanks!

The tutorial pages are published builds in iframes.

Publish your build with PlayCanvas Hosting | Learn PlayCanvas

And use an iframe for your page. eg https://developer.playcanvas.com/en/user-manual/publishing/web/self-hosting/#iframe-embedding

Or you can self host and iframe: https://developer.playcanvas.com/en/user-manual/publishing/web/self-hosting/#self-hosting-on-your-own-server