How would I go about loading all meshes and then programmatically swapping them in the current scene model? I’m guessing I need to use an asset container. Can anyone point me to any relevant documentation or (even better) some code examples?
PS sorry if this question appears twice.
Can you create a repro in the playground ?
It looks like you used the first parameter of ImportMeshAsync
an array of mesh names, a single mesh name, or empty string for all meshes that filter what meshes are imported
Like this ?
PS: You can return to the top of the list by replying to yourself. Don’t worry, I’ve hardly seen an unanswered topic.
Many thanks for your response
The setEnabled function might work, though I’m not quite sure at what level it operates. I also suspect I may be confusing a gltf Mesh object with a Babylon Mesh object.
I have a fixed number of gltf meshes - which define actual geometries through vertex attributes. I also have a number of top level nodes which can reference/instance any one of those meshes at a different position in the scene. All nodes could instance the same mesh or all could instance different meshes. IIUC the setEnabled function would effectively operate at the level of the gltf node rather than the gltf mesh which might not solve my problem.
I’ll look into Babylon Playground to see if I can create a simple example to explore this further.
If I understand you correctly, you’d have to
scene.getMeshByName("") to access the correct meshes. Obbiously you need some way to id the meshes you want to
setEnabled(), be it via hardcoding or a specific way your gltf is structured.
I used getChildMeshes on each node and it returns the expected number of sub nodes, however calling setEnabled(false) on each of these has no effect. Oh well, need to dig deeper.
Dug deeper and discovered a bug in my code.
Things work exactly as you advise. Many thanks!