- slightly improve AbstractPhysicsControl flow
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10531 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
61641eaaf5
commit
ffd8c72c66
@ -164,8 +164,7 @@ public abstract class AbstractPhysicsControl implements PhysicsControl {
|
|||||||
public void setSpatial(Spatial spatial) {
|
public void setSpatial(Spatial spatial) {
|
||||||
if (this.spatial != null && this.spatial != spatial) {
|
if (this.spatial != null && this.spatial != spatial) {
|
||||||
removeSpatialData(this.spatial);
|
removeSpatialData(this.spatial);
|
||||||
}
|
} else if (this.spatial == spatial) {
|
||||||
else if (this.spatial == spatial) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.spatial = spatial;
|
this.spatial = spatial;
|
||||||
@ -207,12 +206,14 @@ public abstract class AbstractPhysicsControl implements PhysicsControl {
|
|||||||
public void setPhysicsSpace(PhysicsSpace space) {
|
public void setPhysicsSpace(PhysicsSpace space) {
|
||||||
if (space == null) {
|
if (space == null) {
|
||||||
if (this.space != null) {
|
if (this.space != null) {
|
||||||
removePhysics(space);
|
removePhysics(this.space);
|
||||||
added = false;
|
added = false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (this.space == space) {
|
if (this.space == space) {
|
||||||
return;
|
return;
|
||||||
|
} else if (this.space != null) {
|
||||||
|
removePhysics(this.space);
|
||||||
}
|
}
|
||||||
addPhysics(space);
|
addPhysics(space);
|
||||||
added = true;
|
added = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user