fix NPE when launching the hovering test with native bullet
This commit is contained in:
parent
93b7be9b83
commit
3e0b838324
@ -94,7 +94,6 @@ public class PhysicsHoverControl extends PhysicsVehicle implements PhysicsContro
|
|||||||
createWheels();
|
createWheels();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Control cloneForSpatial(Spatial spatial) {
|
public Control cloneForSpatial(Spatial spatial) {
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
}
|
}
|
||||||
@ -180,6 +179,7 @@ public class PhysicsHoverControl extends PhysicsVehicle implements PhysicsContro
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setPhysicsSpace(PhysicsSpace space) {
|
public void setPhysicsSpace(PhysicsSpace space) {
|
||||||
|
createVehicle(space);
|
||||||
if (space == null) {
|
if (space == null) {
|
||||||
if (this.space != null) {
|
if (this.space != null) {
|
||||||
this.space.removeCollisionObject(this);
|
this.space.removeCollisionObject(this);
|
||||||
|
|||||||
@ -147,13 +147,13 @@ public class TestHoveringTank extends SimpleApplication implements AnalogListene
|
|||||||
spaceCraft.setLocalRotation(new Quaternion(new float[]{0, 0.01f, 0}));
|
spaceCraft.setLocalRotation(new Quaternion(new float[]{0, 0.01f, 0}));
|
||||||
|
|
||||||
hoverControl = new PhysicsHoverControl(colShape, 500);
|
hoverControl = new PhysicsHoverControl(colShape, 500);
|
||||||
hoverControl.setCollisionGroup(PhysicsCollisionObject.COLLISION_GROUP_02);
|
|
||||||
|
|
||||||
spaceCraft.addControl(hoverControl);
|
spaceCraft.addControl(hoverControl);
|
||||||
|
|
||||||
|
|
||||||
rootNode.attachChild(spaceCraft);
|
rootNode.attachChild(spaceCraft);
|
||||||
getPhysicsSpace().add(hoverControl);
|
getPhysicsSpace().add(hoverControl);
|
||||||
|
hoverControl.setCollisionGroup(PhysicsCollisionObject.COLLISION_GROUP_02);
|
||||||
|
|
||||||
ChaseCamera chaseCam = new ChaseCamera(cam, inputManager);
|
ChaseCamera chaseCam = new ChaseCamera(cam, inputManager);
|
||||||
spaceCraft.addControl(chaseCam);
|
spaceCraft.addControl(chaseCam);
|
||||||
@ -168,7 +168,7 @@ public class TestHoveringTank extends SimpleApplication implements AnalogListene
|
|||||||
|
|
||||||
Spatial missile = assetManager.loadModel("Models/SpaceCraft/Rocket.mesh.xml");
|
Spatial missile = assetManager.loadModel("Models/SpaceCraft/Rocket.mesh.xml");
|
||||||
missile.scale(0.5f);
|
missile.scale(0.5f);
|
||||||
missile.rotate(0, FastMath.PI, 0);
|
missile.rotate(FastMath.PI, FastMath.PI, 0);
|
||||||
missile.updateGeometricState();
|
missile.updateGeometricState();
|
||||||
|
|
||||||
BoundingBox box = (BoundingBox) missile.getWorldBound();
|
BoundingBox box = (BoundingBox) missile.getWorldBound();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user