public Control cloneForSpatial(Spatial spatial) { Node clonedNode = (Node) spatial; AnimControl ctrl = spatial.getControl(AnimControl.class); SkeletonControl clone = new SkeletonControl(); clone.setSpatial(clonedNode); clone.skeleton = ctrl.getSkeleton(); // Fix animated targets for the cloned node clone.targets = findTargets(clonedNode); // Fix attachments for the cloned node for (int i = 0; i < clonedNode.getQuantity(); i++) { // go through attachment nodes, apply them to correct bone Spatial child = clonedNode.getChild(i); if (child instanceof Node) { Node clonedAttachNode = (Node) child; Bone originalBone = (Bone) clonedAttachNode.getUserData("AttachedBone"); if (originalBone != null) { Bone clonedBone = clone.skeleton.getBone(originalBone.getName()); clonedAttachNode.setUserData("AttachedBone", clonedBone); clonedBone.setAttachmentsNode(clonedAttachNode); } } } return clone; }