Cloning Issues with Skinned Meshes in Threejs

Published

I was trying out ThreeJS as a web first alternative to Unity and while it was working great I had some issues when cloning an imported FBX: the mesh has a deep nested hierarchy and the output mesh I got from calling mesh.clone() would have some nodes depend on the base object.

This meant that moving the base object would move part of the cloned object, and that moving the cloned object would not move everything. Properties would also be affected: elements would not all receive the scale modification even if the scale modification was applied to a parent group.

Thankfully the fix is simple but I had to find it in the github issues, I’m unsure if it was available anywhere.

So here it is: When cloning Skinned Meshes, use SkeletonUtils.clone() instead of the base clone method.

Hope that saves you some time. This issue is referenced here: