Removes the use of the deprecated Box contructor with the mesh origin in HelloPicking, made the crosshair properly centered. Also updated the wiki

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10725 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
rem..om 12 years ago
parent 2224767cbe
commit 5962b6cc39
  1. 12
      engine/src/test/jme3test/helloworld/HelloPicking.java

@ -60,8 +60,8 @@ public class HelloPicking extends SimpleApplication {
HelloPicking app = new HelloPicking(); HelloPicking app = new HelloPicking();
app.start(); app.start();
} }
Node shootables; private Node shootables;
Geometry mark; private Geometry mark;
@Override @Override
public void simpleInitApp() { public void simpleInitApp() {
@ -125,8 +125,9 @@ public class HelloPicking extends SimpleApplication {
/** A cube object for target practice */ /** A cube object for target practice */
protected Geometry makeCube(String name, float x, float y, float z) { protected Geometry makeCube(String name, float x, float y, float z) {
Box box = new Box(new Vector3f(x, y, z), 1, 1, 1); Box box = new Box(1, 1, 1);
Geometry cube = new Geometry(name, box); Geometry cube = new Geometry(name, box);
cube.setLocalTranslation(x, y, z);
Material mat1 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); Material mat1 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat1.setColor("Color", ColorRGBA.randomColor()); mat1.setColor("Color", ColorRGBA.randomColor());
cube.setMaterial(mat1); cube.setMaterial(mat1);
@ -135,8 +136,9 @@ public class HelloPicking extends SimpleApplication {
/** A floor to show that the "shot" can go through several objects. */ /** A floor to show that the "shot" can go through several objects. */
protected Geometry makeFloor() { protected Geometry makeFloor() {
Box box = new Box(new Vector3f(0, -4, -5), 15, .2f, 15); Box box = new Box(15, .2f, 15);
Geometry floor = new Geometry("the Floor", box); Geometry floor = new Geometry("the Floor", box);
floor.setLocalTranslation(0, -4, -5);
Material mat1 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); Material mat1 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat1.setColor("Color", ColorRGBA.Gray); mat1.setColor("Color", ColorRGBA.Gray);
floor.setMaterial(mat1); floor.setMaterial(mat1);
@ -160,7 +162,7 @@ public class HelloPicking extends SimpleApplication {
ch.setSize(guiFont.getCharSet().getRenderedSize() * 2); ch.setSize(guiFont.getCharSet().getRenderedSize() * 2);
ch.setText("+"); // crosshairs ch.setText("+"); // crosshairs
ch.setLocalTranslation( // center ch.setLocalTranslation( // center
settings.getWidth() / 2, settings.getHeight() / 2, 0); settings.getWidth() / 2 - ch.getLineWidth()/2, settings.getHeight() / 2 + ch.getLineHeight()/2, 0);
guiNode.attachChild(ch); guiNode.attachChild(ch);
} }

Loading…
Cancel
Save