From c4525aa5506a4cc74d82d264a0b077ec896035c4 Mon Sep 17 00:00:00 2001 From: Nehon Date: Sun, 20 Mar 2016 18:56:19 +0100 Subject: [PATCH] Fixed MotionEvent clone for Spatial as it was resulting in controls added twice to the spatial. Also removed a useless line in all the constructors. --- .../main/java/com/jme3/cinematic/events/MotionEvent.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/jme3-core/src/main/java/com/jme3/cinematic/events/MotionEvent.java b/jme3-core/src/main/java/com/jme3/cinematic/events/MotionEvent.java index dbb9b494c..47788275b 100644 --- a/jme3-core/src/main/java/com/jme3/cinematic/events/MotionEvent.java +++ b/jme3-core/src/main/java/com/jme3/cinematic/events/MotionEvent.java @@ -120,7 +120,6 @@ public class MotionEvent extends AbstractCinematicEvent implements Control, JmeC */ public MotionEvent(Spatial spatial, MotionPath path) { super(); - this.spatial = spatial; spatial.addControl(this); this.path = path; } @@ -132,7 +131,6 @@ public class MotionEvent extends AbstractCinematicEvent implements Control, JmeC */ public MotionEvent(Spatial spatial, MotionPath path, float initialDuration) { super(initialDuration); - this.spatial = spatial; spatial.addControl(this); this.path = path; } @@ -144,7 +142,6 @@ public class MotionEvent extends AbstractCinematicEvent implements Control, JmeC */ public MotionEvent(Spatial spatial, MotionPath path, LoopMode loopMode) { super(); - this.spatial = spatial; spatial.addControl(this); this.path = path; this.loopMode = loopMode; @@ -157,7 +154,6 @@ public class MotionEvent extends AbstractCinematicEvent implements Control, JmeC */ public MotionEvent(Spatial spatial, MotionPath path, float initialDuration, LoopMode loopMode) { super(initialDuration); - this.spatial = spatial; spatial.addControl(this); this.path = path; this.loopMode = loopMode; @@ -278,7 +274,8 @@ public class MotionEvent extends AbstractCinematicEvent implements Control, JmeC */ @Override public Control cloneForSpatial(Spatial spatial) { - MotionEvent control = new MotionEvent(spatial, path); + MotionEvent control = new MotionEvent(); + control.setPath(path); control.playState = playState; control.currentWayPoint = currentWayPoint; control.currentValue = currentValue;