Best way to duplicate the same FBX model?

Hello. If I wanted to duplicate an animated FBX model many times throughout a scene what would be an efficient way to do that? I also want to preserve a unique material for each model. All the models will be the same but have different colors/materials.

The code below throws the error, “Cannot read property ‘frame’ of undefined” when render is called.

fbx_loader.load( file, ( fbx ) => {

var clone = fbx.clone();
clone.animations = fbx.animations;
MYTHREE.scene.add( clone );

});

Object3D.clone() will not properly clone instances of SkinnedMesh. You have to use SkeletonUtils.clone() for this scenario.

1 Like

Nice. Working so far. How do I preserve a unique material. Right now, if I change the color on the clone it changes the color of the original.

Cloning a mesh will not clone geometry and material(s). Meaning if you need a unique material per clone, you need to clone the material by yourself.

1 Like