- change bullet PhysicsControls to keep their CollisionShape when detaching
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9665 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
37710098a2
commit
b4a55256de
@ -79,14 +79,9 @@ public class CharacterControl extends PhysicsCharacter implements PhysicsControl
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setSpatial(Spatial spatial) {
|
public void setSpatial(Spatial spatial) {
|
||||||
if (getUserObject() == null || getUserObject() == this.spatial) {
|
|
||||||
setUserObject(spatial);
|
|
||||||
}
|
|
||||||
this.spatial = spatial;
|
this.spatial = spatial;
|
||||||
|
setUserObject(spatial);
|
||||||
if (spatial == null) {
|
if (spatial == null) {
|
||||||
if (getUserObject() == spatial) {
|
|
||||||
setUserObject(null);
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setPhysicsLocation(getSpatialTranslation());
|
setPhysicsLocation(getSpatialTranslation());
|
||||||
|
@ -81,14 +81,9 @@ public class GhostControl extends PhysicsGhostObject implements PhysicsControl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setSpatial(Spatial spatial) {
|
public void setSpatial(Spatial spatial) {
|
||||||
if (getUserObject() == null || getUserObject() == this.spatial) {
|
|
||||||
setUserObject(spatial);
|
|
||||||
}
|
|
||||||
this.spatial = spatial;
|
this.spatial = spatial;
|
||||||
|
setUserObject(spatial);
|
||||||
if (spatial == null) {
|
if (spatial == null) {
|
||||||
if (getUserObject() == spatial) {
|
|
||||||
setUserObject(null);
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setPhysicsLocation(getSpatialTranslation());
|
setPhysicsLocation(getSpatialTranslation());
|
||||||
|
@ -13,6 +13,10 @@ import com.jme3.scene.control.Control;
|
|||||||
*/
|
*/
|
||||||
public interface PhysicsControl extends Control {
|
public interface PhysicsControl extends Control {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Only used internally, do not call.
|
||||||
|
* @param space
|
||||||
|
*/
|
||||||
public void setPhysicsSpace(PhysicsSpace space);
|
public void setPhysicsSpace(PhysicsSpace space);
|
||||||
|
|
||||||
public PhysicsSpace getPhysicsSpace();
|
public PhysicsSpace getPhysicsSpace();
|
||||||
|
@ -91,16 +91,9 @@ public class RigidBodyControl extends PhysicsRigidBody implements PhysicsControl
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setSpatial(Spatial spatial) {
|
public void setSpatial(Spatial spatial) {
|
||||||
if (getUserObject() == null || getUserObject() == this.spatial) {
|
|
||||||
setUserObject(spatial);
|
|
||||||
}
|
|
||||||
this.spatial = spatial;
|
this.spatial = spatial;
|
||||||
|
setUserObject(spatial);
|
||||||
if (spatial == null) {
|
if (spatial == null) {
|
||||||
if (getUserObject() == spatial) {
|
|
||||||
setUserObject(null);
|
|
||||||
}
|
|
||||||
spatial = null;
|
|
||||||
collisionShape = null;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (collisionShape == null) {
|
if (collisionShape == null) {
|
||||||
|
@ -133,16 +133,9 @@ public class VehicleControl extends PhysicsVehicle implements PhysicsControl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setSpatial(Spatial spatial) {
|
public void setSpatial(Spatial spatial) {
|
||||||
if (getUserObject() == null || getUserObject() == this.spatial) {
|
|
||||||
setUserObject(spatial);
|
|
||||||
}
|
|
||||||
this.spatial = spatial;
|
this.spatial = spatial;
|
||||||
|
setUserObject(spatial);
|
||||||
if (spatial == null) {
|
if (spatial == null) {
|
||||||
if (getUserObject() == spatial) {
|
|
||||||
setUserObject(null);
|
|
||||||
}
|
|
||||||
this.spatial = null;
|
|
||||||
this.collisionShape = null;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setPhysicsLocation(getSpatialTranslation());
|
setPhysicsLocation(getSpatialTranslation());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user