Is it possible to load a gltf model from a string?

I want to do something like this, where the glb model was loaded from a string stored in a variable, not an external file.

Hi @Marks,

I don’t think there is an API for that. You could still do this using a custom resource model/render handler, that maps the expected values and creates the mesh/mesh instances from the string data.

@yaustar any idea where to start with that?

1 Like

There’s no API for this. You may be able to dig into the engine or the playcanvas-viewer source code as the viewer does support a GLTF + BIN file combination IIRC

However, it would be a lot easier to convert a GLB binary file to base64 and load it by URL that way

2 Likes