From 5962b6cc39e7fdd235b58e7c1c036d44657b2aca Mon Sep 17 00:00:00 2001 From: "rem..om" Date: Sun, 14 Jul 2013 11:41:44 +0000 Subject: [PATCH] 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 --- .../src/test/jme3test/helloworld/HelloPicking.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/engine/src/test/jme3test/helloworld/HelloPicking.java b/engine/src/test/jme3test/helloworld/HelloPicking.java index f01f77f4c..4c74b9012 100644 --- a/engine/src/test/jme3test/helloworld/HelloPicking.java +++ b/engine/src/test/jme3test/helloworld/HelloPicking.java @@ -60,8 +60,8 @@ public class HelloPicking extends SimpleApplication { HelloPicking app = new HelloPicking(); app.start(); } - Node shootables; - Geometry mark; + private Node shootables; + private Geometry mark; @Override public void simpleInitApp() { @@ -125,8 +125,9 @@ public class HelloPicking extends SimpleApplication { /** A cube object for target practice */ 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); + cube.setLocalTranslation(x, y, z); Material mat1 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat1.setColor("Color", ColorRGBA.randomColor()); cube.setMaterial(mat1); @@ -135,8 +136,9 @@ public class HelloPicking extends SimpleApplication { /** A floor to show that the "shot" can go through several objects. */ 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); + floor.setLocalTranslation(0, -4, -5); Material mat1 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat1.setColor("Color", ColorRGBA.Gray); floor.setMaterial(mat1); @@ -160,7 +162,7 @@ public class HelloPicking extends SimpleApplication { ch.setSize(guiFont.getCharSet().getRenderedSize() * 2); ch.setText("+"); // crosshairs 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); }