Is it too different to load model inside the platform instead of engine-only?

So, I loaded one day few times gltf asset engine-only but how to do from assets in the platform, I mean at runtime but also give the name and glb extension?
For example I want to load name.glb
where name is parameter name so would be specific car,
so camaro.glb or m3.glb or else car
but only one at a time not all
what I did in engine only version in short I did like this:
car + '.gltf' when loaded
where car is string of some car name
but the difference is when I did this engine only I accessed the files from folder not as in platform when you have assets so root folder with specific assets
(so maybe no difference when referring as relative path)

I look into asset registry and few other tutorials but I’m little confused
what reminds me I added models to asset registry as in case of engine-only
like this app.assets.add(asset);

as is in GitHub - playcanvas/playcanvas-gltf: glTF 2.0 support for the PlayCanvas Engine
I know now this is deprecated

As it’s glb,

1 Like

ok but I see in this example only by dragging asset to ‘asset slot’ so how to provide the model not this.glbAsset?

one day I did like this app.assets.loadFromUrl('assets/models/camaro.glb', 'binary', function (err, asset) {
but this way engine only,
here (as platform) I have no clue yet

Is the GLB file from an external exporter or was it from importing a FBX into the PlayCanvas editor?

In the example I linked, the GLB is from an external exporter. The GLB is a binary asset and the resource contains the actually binary data.

It has to be loaded as a container type to access the model, materials, animations and textures inside.

source is fbx

Can you give a link to a project of what you are trying to do? It probably be easier seeing your actual starting point.
the folder cars here are cars folders and in each folder is model in fbx and the glbs converted
so I would do name/name.glb or sth similar as camaro/camaro.glb
or just toggling the entitites with enabled :sweat_smile: ?
generally I want to just select one car
I did the selection but only engine-only one day

Assuming you are referring to this type of GLB, as it’s a model asset, reference the asset and the asset.resource is the model.

Assign that to the model component via the model property and that should be it:

If the asset is not loaded yet, you will have to load the asset via the asset registry, wait for the ‘ready’ event and then assign the resource to the model component

1 Like