diff --git a/jme3-core/src/main/java/com/jme3/animation/SkeletonControl.java b/jme3-core/src/main/java/com/jme3/animation/SkeletonControl.java index d5ef31939..4d001c365 100644 --- a/jme3-core/src/main/java/com/jme3/animation/SkeletonControl.java +++ b/jme3-core/src/main/java/com/jme3/animation/SkeletonControl.java @@ -347,11 +347,22 @@ public class SkeletonControl extends AbstractControl implements Cloneable { public Control cloneForSpatial(Spatial spatial) { Node clonedNode = (Node) spatial; - AnimControl ctrl = spatial.getControl(AnimControl.class); SkeletonControl clone = new SkeletonControl(); - clone.skeleton = ctrl.getSkeleton(); - + AnimControl ctrl = spatial.getControl(AnimControl.class); + if (ctrl != null) { + // AnimControl is responsible for cloning the skeleton, not + // SkeletonControl. + clone.skeleton = ctrl.getSkeleton(); + } else { + // If there's no AnimControl, create the clone ourselves. + clone.skeleton = new Skeleton(skeleton); + } + clone.hwSkinningDesired = this.hwSkinningDesired; + clone.hwSkinningEnabled = this.hwSkinningEnabled; + clone.hwSkinningSupported = this.hwSkinningSupported; + clone.hwSkinningTested = this.hwSkinningTested; + clone.setSpatial(clonedNode); // Fix attachments for the cloned node