GLTF: create multiple instances of a mesh from an asset/gltf file

Hey everyone,

I’m trying to load a gltf file once and then use it’s mesh multiple times. It’s a game scenario where you load an item asset once and then display that item multiple times in the world with the same animations, textures, materials but at different positions/rotations/scale.

I forked a codepen displaying the problems I’m having with it:

In line 82, if the count is bigger than 1 (set it to 10 for testing), it tries to clone() the scene from the file, but you can see that the material does not get cloned/re-used properly.

In my game, cloning the mesh that I filtered by name even shows a different mesh from the same file at the same time in the wrong position (right). When I don’t use clone(), the algorithm does it’s thing properly (left):


What am I missing here?

Thank you!

I just found a very good article on this:

import { SkeletonUtils } from "three/examples/jsm/utils/SkeletonUtils";


This fixes my problem with it flawlessly!!