From ffd8c72c667ab833b0e8649cb580e90081de787a Mon Sep 17 00:00:00 2001 From: "nor..67" Date: Fri, 12 Apr 2013 13:06:45 +0000 Subject: [PATCH] - slightly improve AbstractPhysicsControl flow git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10531 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../com/jme3/bullet/control/AbstractPhysicsControl.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/engine/src/bullet-common/com/jme3/bullet/control/AbstractPhysicsControl.java b/engine/src/bullet-common/com/jme3/bullet/control/AbstractPhysicsControl.java index 71526d0a6..7c69fdf51 100644 --- a/engine/src/bullet-common/com/jme3/bullet/control/AbstractPhysicsControl.java +++ b/engine/src/bullet-common/com/jme3/bullet/control/AbstractPhysicsControl.java @@ -160,12 +160,11 @@ public abstract class AbstractPhysicsControl implements PhysicsControl { } } - + public void setSpatial(Spatial spatial) { if (this.spatial != null && this.spatial != spatial) { removeSpatialData(this.spatial); - } - else if (this.spatial == spatial) { + } else if (this.spatial == spatial) { return; } this.spatial = spatial; @@ -207,12 +206,14 @@ public abstract class AbstractPhysicsControl implements PhysicsControl { public void setPhysicsSpace(PhysicsSpace space) { if (space == null) { if (this.space != null) { - removePhysics(space); + removePhysics(this.space); added = false; } } else { if (this.space == space) { return; + } else if (this.space != null) { + removePhysics(this.space); } addPhysics(space); added = true;