make TerrainTestCollision more user-friendly

monkanim
Stephen Gold 7 years ago
parent 555a348692
commit 0014ede4d7
  1. 12
      jme3-examples/src/main/java/jme3test/terrain/TerrainTestCollision.java

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2009-2012 jMonkeyEngine * Copyright (c) 2009-2018 jMonkeyEngine
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -48,6 +48,7 @@ import com.jme3.light.DirectionalLight;
import com.jme3.light.PointLight; import com.jme3.light.PointLight;
import com.jme3.material.Material; import com.jme3.material.Material;
import com.jme3.math.ColorRGBA; import com.jme3.math.ColorRGBA;
import com.jme3.math.Quaternion;
import com.jme3.math.Ray; import com.jme3.math.Ray;
import com.jme3.math.Vector2f; import com.jme3.math.Vector2f;
import com.jme3.math.Vector3f; import com.jme3.math.Vector3f;
@ -176,16 +177,15 @@ public class TerrainTestCollision extends SimpleApplication {
dl.setColor(new ColorRGBA(0.50f, 0.40f, 0.50f, 1.0f)); dl.setColor(new ColorRGBA(0.50f, 0.40f, 0.50f, 1.0f));
rootNode.addLight(dl); rootNode.addLight(dl);
cam.setLocation(new Vector3f(0, 25, -10)); cam.setLocation(new Vector3f(43f, 121f, 10f));
cam.lookAtDirection(new Vector3f(0, -1, 0).normalizeLocal(), Vector3f.UNIT_Y); cam.setRotation(new Quaternion(0.15824f, -0.79309f, 0.23223f, 0.5404f));
} }
public void loadHintText() { public void loadHintText() {
hintText = new BitmapText(guiFont, false); hintText = new BitmapText(guiFont, false);
hintText.setSize(guiFont.getCharSet().getRenderedSize()); hintText.setSize(guiFont.getCharSet().getRenderedSize());
hintText.setLocalTranslation(0, getCamera().getHeight(), 0); hintText.setLocalTranslation(0, getCamera().getHeight(), 0);
//hintText.setText("Hit T to switch to wireframe"); hintText.setText("Press T to toggle wireframe");
hintText.setText("");
guiNode.attachChild(hintText); guiNode.attachChild(hintText);
} }
@ -241,7 +241,7 @@ public class TerrainTestCollision extends SimpleApplication {
public void onAction(String binding, boolean keyPressed, float tpf) { public void onAction(String binding, boolean keyPressed, float tpf) {
if (binding.equals("wireframe") && !keyPressed) { if (binding.equals("wireframe") && !keyPressed) {
wireframe = !wireframe; wireframe = !wireframe;
if (!wireframe) { if (wireframe) {
terrain.setMaterial(matWire); terrain.setMaterial(matWire);
} else { } else {
terrain.setMaterial(matRock); terrain.setMaterial(matRock);

Loading…
Cancel
Save