diff --git a/engine/src/core/com/jme3/scene/Spatial.java b/engine/src/core/com/jme3/scene/Spatial.java index 72927d71d..9b509f26d 100644 --- a/engine/src/core/com/jme3/scene/Spatial.java +++ b/engine/src/core/com/jme3/scene/Spatial.java @@ -1182,7 +1182,9 @@ public abstract class Spatial implements Savable, Cloneable, Collidable, Cloneab clone.controls = new SafeArrayList(Control.class); for (int i = 0; i < controls.size(); i++) { - clone.controls.add(controls.get(i).cloneForSpatial(clone)); + Control newControl = controls.get(i).cloneForSpatial(clone); + newControl.setSpatial(this); + clone.controls.add(newControl); } if (userData != null) { diff --git a/engine/src/core/com/jme3/scene/control/AbstractControl.java b/engine/src/core/com/jme3/scene/control/AbstractControl.java index 39ebc14e8..43cae6db5 100644 --- a/engine/src/core/com/jme3/scene/control/AbstractControl.java +++ b/engine/src/core/com/jme3/scene/control/AbstractControl.java @@ -54,7 +54,7 @@ public abstract class AbstractControl implements Control { } public void setSpatial(Spatial spatial) { - if (this.spatial != null && spatial != null) { + if (this.spatial != null && spatial != null && spatial != this.spatial) { throw new IllegalStateException("This control has already been added to a Spatial"); } this.spatial = spatial;