From b4a55256deef0cc74b6b9bf1d9f5b79ec76817e0 Mon Sep 17 00:00:00 2001 From: "nor..67" Date: Thu, 16 Aug 2012 21:49:06 +0000 Subject: [PATCH] - change bullet PhysicsControls to keep their CollisionShape when detaching git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9665 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../com/jme3/bullet/control/CharacterControl.java | 7 +------ .../com/jme3/bullet/control/GhostControl.java | 7 +------ .../com/jme3/bullet/control/PhysicsControl.java | 4 ++++ .../com/jme3/bullet/control/RigidBodyControl.java | 9 +-------- .../com/jme3/bullet/control/VehicleControl.java | 9 +-------- 5 files changed, 8 insertions(+), 28 deletions(-) diff --git a/engine/src/bullet-common/com/jme3/bullet/control/CharacterControl.java b/engine/src/bullet-common/com/jme3/bullet/control/CharacterControl.java index 2acac5316..909328a93 100644 --- a/engine/src/bullet-common/com/jme3/bullet/control/CharacterControl.java +++ b/engine/src/bullet-common/com/jme3/bullet/control/CharacterControl.java @@ -79,14 +79,9 @@ public class CharacterControl extends PhysicsCharacter implements PhysicsControl } public void setSpatial(Spatial spatial) { - if (getUserObject() == null || getUserObject() == this.spatial) { - setUserObject(spatial); - } this.spatial = spatial; + setUserObject(spatial); if (spatial == null) { - if (getUserObject() == spatial) { - setUserObject(null); - } return; } setPhysicsLocation(getSpatialTranslation()); diff --git a/engine/src/bullet-common/com/jme3/bullet/control/GhostControl.java b/engine/src/bullet-common/com/jme3/bullet/control/GhostControl.java index 99e598480..38ec0dd31 100644 --- a/engine/src/bullet-common/com/jme3/bullet/control/GhostControl.java +++ b/engine/src/bullet-common/com/jme3/bullet/control/GhostControl.java @@ -81,14 +81,9 @@ public class GhostControl extends PhysicsGhostObject implements PhysicsControl { } public void setSpatial(Spatial spatial) { - if (getUserObject() == null || getUserObject() == this.spatial) { - setUserObject(spatial); - } this.spatial = spatial; + setUserObject(spatial); if (spatial == null) { - if (getUserObject() == spatial) { - setUserObject(null); - } return; } setPhysicsLocation(getSpatialTranslation()); diff --git a/engine/src/bullet-common/com/jme3/bullet/control/PhysicsControl.java b/engine/src/bullet-common/com/jme3/bullet/control/PhysicsControl.java index ba6515789..3d6e98cc8 100644 --- a/engine/src/bullet-common/com/jme3/bullet/control/PhysicsControl.java +++ b/engine/src/bullet-common/com/jme3/bullet/control/PhysicsControl.java @@ -13,6 +13,10 @@ import com.jme3.scene.control.Control; */ public interface PhysicsControl extends Control { + /** + * Only used internally, do not call. + * @param space + */ public void setPhysicsSpace(PhysicsSpace space); public PhysicsSpace getPhysicsSpace(); diff --git a/engine/src/bullet-common/com/jme3/bullet/control/RigidBodyControl.java b/engine/src/bullet-common/com/jme3/bullet/control/RigidBodyControl.java index 4fbce1e33..0c0297833 100644 --- a/engine/src/bullet-common/com/jme3/bullet/control/RigidBodyControl.java +++ b/engine/src/bullet-common/com/jme3/bullet/control/RigidBodyControl.java @@ -91,16 +91,9 @@ public class RigidBodyControl extends PhysicsRigidBody implements PhysicsControl } public void setSpatial(Spatial spatial) { - if (getUserObject() == null || getUserObject() == this.spatial) { - setUserObject(spatial); - } this.spatial = spatial; + setUserObject(spatial); if (spatial == null) { - if (getUserObject() == spatial) { - setUserObject(null); - } - spatial = null; - collisionShape = null; return; } if (collisionShape == null) { diff --git a/engine/src/bullet-common/com/jme3/bullet/control/VehicleControl.java b/engine/src/bullet-common/com/jme3/bullet/control/VehicleControl.java index 0f04f41c8..61413fb86 100644 --- a/engine/src/bullet-common/com/jme3/bullet/control/VehicleControl.java +++ b/engine/src/bullet-common/com/jme3/bullet/control/VehicleControl.java @@ -133,16 +133,9 @@ public class VehicleControl extends PhysicsVehicle implements PhysicsControl { } public void setSpatial(Spatial spatial) { - if (getUserObject() == null || getUserObject() == this.spatial) { - setUserObject(spatial); - } this.spatial = spatial; + setUserObject(spatial); if (spatial == null) { - if (getUserObject() == spatial) { - setUserObject(null); - } - this.spatial = null; - this.collisionShape = null; return; } setPhysicsLocation(getSpatialTranslation());