Merge pull request #613 from JavaSaBr/fixed_saving_and_cloning_some_controls

Fixed cloning and saving some contorls.
This commit is contained in:
empirephoenix 2017-02-03 08:43:16 +01:00 committed by GitHub
commit 6f32651fb1
2 changed files with 13 additions and 7 deletions

View File

@ -121,6 +121,7 @@ public class CharacterControl extends PhysicsCharacter implements PhysicsControl
control.setUpAxis(getUpAxis()); control.setUpAxis(getUpAxis());
control.setApplyPhysicsLocal(isApplyPhysicsLocal()); control.setApplyPhysicsLocal(isApplyPhysicsLocal());
control.spatial = this.spatial; control.spatial = this.spatial;
control.setEnabled(isEnabled());
return control; return control;
} }
@ -207,11 +208,12 @@ public class CharacterControl extends PhysicsCharacter implements PhysicsControl
added = false; added = false;
} }
} else { } else {
if (this.space == space) { if(this.space == space) return;
return; // if this object isn't enabled, it will be added when it will be enabled.
if (isEnabled()) {
space.addCollisionObject(this);
added = true;
} }
space.addCollisionObject(this);
added = true;
} }
this.space = space; this.space = space;
} }

View File

@ -200,6 +200,7 @@ public class VehicleControl extends PhysicsVehicle implements PhysicsControl, Jm
newWheel.setWheelSpatial(wheel.getWheelSpatial()); newWheel.setWheelSpatial(wheel.getWheelSpatial());
} }
control.setApplyPhysicsLocal(isApplyPhysicsLocal()); control.setApplyPhysicsLocal(isApplyPhysicsLocal());
control.setEnabled(isEnabled());
control.spatial = spatial; control.spatial = spatial;
return control; return control;
@ -268,9 +269,12 @@ public class VehicleControl extends PhysicsVehicle implements PhysicsControl, Jm
added = false; added = false;
} }
} else { } else {
if(this.space==space) return; if(this.space == space) return;
space.addCollisionObject(this); // if this object isn't enabled, it will be added when it will be enabled.
added = true; if (isEnabled()) {
space.addCollisionObject(this);
added = true;
}
} }
this.space = space; this.space = space;
} }