Hi all.
I’m getting errors when trying to instance a loaded GLB, “Instances should only be created for meshes with geometry.”
Reading up on past threads and see that we should use instantiateHierarchy on the loaded meshes array. Tried that, but the instance a) doesn’t seem to appear on screen and b) when moved to a different position using the inspector, throws the “with geometry” error.
In my PG above, I’d simplified out the AssetsManager component to focus on the problem, but was then worried after seeing your example that it’d be incompatible with AssetsManager. Looks like there’s already a fix there though. Trying it shortly.
won’t work, because the instantiateModelsToScene method only deals with root objects, i.e. objects with parent === null.
If what you want is parenting to avoid having lots of objects at the root level in the inspector, set a parent as you do, before calling duplicate do task.loadedContainer.rootNodes[0].parent = null; and after it returns set task.loadedContainer.rootNodes[0].parent = group; again.
Note that “house task” is the initial object that you set to invisible after loading, so it’s expected the bounding box does not show up for these invisible objects.
Actually, there’s a bug in instantiateModelsToScene, that’s why you get these warnings => you can see that the original tree is not instantiated correctly, some foliages are missing in the instances.
@RaananW It seems this PR does not handle the case where the instanced mesh is not at the root level but is a child of another mesh. Try this PG for eg:
Actually, i think something did change (b/c i dont think i posted an empty pg earlier!). How can you remove or hide the original mesh without impacting the clones? See this PG. Whenever I set the isVisible property of the original loaded mesh to false, it can’t be turned on again for the clones (as far as i can tell):