fixed cloning and saving some contorls.

This commit is contained in:
javasabr 2017-02-03 09:16:06 +03:00
parent 071e449a3e
commit e26f0f133b
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.setApplyPhysicsLocal(isApplyPhysicsLocal());
control.spatial = this.spatial;
control.setEnabled(isEnabled());
return control;
}
@ -207,12 +208,13 @@ public class CharacterControl extends PhysicsCharacter implements PhysicsControl
added = false;
}
} else {
if (this.space == space) {
return;
}
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;
}

View File

@ -200,6 +200,7 @@ public class VehicleControl extends PhysicsVehicle implements PhysicsControl, Jm
newWheel.setWheelSpatial(wheel.getWheelSpatial());
}
control.setApplyPhysicsLocal(isApplyPhysicsLocal());
control.setEnabled(isEnabled());
control.spatial = spatial;
return control;
@ -269,9 +270,12 @@ public class VehicleControl extends PhysicsVehicle implements PhysicsControl, Jm
}
} else {
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;
}