I’m trying to add instanced meshes to existing meshes created with glTF loader in a 3x3 grid fashion, with the original mesh at the center. For some reason, however, the instanced meshes are not visible when I add them to the scene. I created a jsfiddle (Three.js r115 + glTF Loader + instanced mesh test - JSFiddle - Code Playground) based on an existing glTF loader demo, and the error persists. I’ve tried traversing all the children of the mesh and adding an instanced mesh to every child that is a mesh, and it still doesn’t work. What am I doing wrong? Are glTF models supposed to be handled differently? Thanks in advance.
The first issue here is one of scale, you’ll need to bring the InstancedMesh up to the scale of the base mesh or it’s too small to see. Trying inst.scale.set(100, 100, 100);
should make it visible. A secondary issue, but I’m not sure how/if morph targets are supported with InstancedMesh. It might work fine, but I might recommend testing with a static mesh first until you have things working. A newer version of three.js (r115 is 4 years old) might also make it easier to check the current examples and docs.
Thanks for the reply! I managed to fix my code (Three.js glTF Loader instanced mesh test - JSFiddle - Code Playground) and found out the problem isn’t glTF meshes, it’s skinned meshes. Instancing skinned meshes does seem like a lot of trouble from what I’ve read though… I’m currently trying to implement this same example with skinned meshes according to this post: Animated Instanced Skinned Meshes (GLTF) - #22 by Sceat but I got the same issue. I’m using the InstancedSkinnedMesh module provided on the post. I’ll leave this question open for now since it’s only partially solved. And thanks again!