From 637635d53fbe0fc8c942076ee763a5f41d1e54ce Mon Sep 17 00:00:00 2001 From: javasabr Date: Sun, 29 Jan 2017 23:30:28 +0300 Subject: [PATCH] Fixed saving/cloning enabled state of a RigidBodyControl. --- .../com/jme3/bullet/control/RigidBodyControl.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/jme3-bullet/src/common/java/com/jme3/bullet/control/RigidBodyControl.java b/jme3-bullet/src/common/java/com/jme3/bullet/control/RigidBodyControl.java index 25a23cc7c..f2002be02 100644 --- a/jme3-bullet/src/common/java/com/jme3/bullet/control/RigidBodyControl.java +++ b/jme3-bullet/src/common/java/com/jme3/bullet/control/RigidBodyControl.java @@ -53,6 +53,7 @@ import com.jme3.scene.shape.Box; import com.jme3.scene.shape.Sphere; import com.jme3.util.clone.Cloner; import com.jme3.util.clone.JmeCloneable; + import java.io.IOException; /** @@ -143,6 +144,8 @@ public class RigidBodyControl extends PhysicsRigidBody implements PhysicsControl } control.setApplyPhysicsLocal(isApplyPhysicsLocal()); control.spatial = this.spatial; + control.setEnabled(isEnabled()); + return control; } @@ -273,9 +276,12 @@ public class RigidBodyControl extends PhysicsRigidBody implements PhysicsControl added = false; } } else { - if(this.space==space) return; - space.addCollisionObject(this); - added = true; + if (this.space == space) return; + // if this object isn't enabled, it will be added when it will be enabled. + if (isEnabled()) { + space.addCollisionObject(this); + added = true; + } } this.space = space; }