Fix: fixed exception when trying to jump with physics turned off

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7910 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
ant..om 14 years ago
parent 7308cdfca6
commit 06e04c429c
  1. 7
      engine/src/test/jme3test/terrain/TerrainFractalGridTest.java

@ -42,7 +42,6 @@ public class TerrainFractalGridTest extends SimpleApplication {
private float dirtScale = 16; private float dirtScale = 16;
private float rockScale = 128; private float rockScale = 128;
private boolean usePhysics = false; private boolean usePhysics = false;
private boolean physicsAdded = false;
public static void main(final String[] args) { public static void main(final String[] args) {
TerrainFractalGridTest app = new TerrainFractalGridTest(); TerrainFractalGridTest app = new TerrainFractalGridTest();
@ -163,7 +162,7 @@ public class TerrainFractalGridTest extends SimpleApplication {
player3.setFallSpeed(10); player3.setFallSpeed(10);
player3.setGravity(10); player3.setGravity(10);
player3.setPhysicsLocation(new Vector3f(cam.getLocation().x, 256, cam.getLocation().z)); player3.setPhysicsLocation(new Vector3f(cam.getLocation().x, 512, cam.getLocation().z));
bulletAppState.getPhysicsSpace().add(player3); bulletAppState.getPhysicsSpace().add(player3);
@ -238,7 +237,9 @@ public class TerrainFractalGridTest extends SimpleApplication {
TerrainFractalGridTest.this.down = false; TerrainFractalGridTest.this.down = false;
} }
} else if (name.equals("Jumps")) { } else if (name.equals("Jumps")) {
TerrainFractalGridTest.this.player3.jump(); if (usePhysics) {
TerrainFractalGridTest.this.player3.jump();
}
} }
} }
}; };

Loading…
Cancel
Save