jMonkeyEngine3 – add a grid to view the “floor”

Call this method in the public void simpleInitApp() method

private void attachGrid(Vector3f pos, int size, ColorRGBA color) {
  Geometry g = new Geometry("wireframe grid", new Grid(size, size, 0.2f));
  Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
  mat.getAdditionalRenderState().setWireframe(true);
  mat.setColor("Color", color);
  g.setMaterial(mat);
  g.center().move(pos);
  rootNode.attachChild(g);
}

jMonkeyEngine3 – add the 3D axes

Call this method in the public void simpleInitApp() method

private void attachCoordinateAxes(Vector3f pos) {
 Arrow arrow = new Arrow(Vector3f.UNIT_X);
 arrow.setLineWidth(4); // make arrow thicker
 putShape(arrow, ColorRGBA.Red).setLocalTranslation(pos);

 arrow = new Arrow(Vector3f.UNIT_Y);
 arrow.setLineWidth(4); // make arrow thicker
 putShape(arrow, ColorRGBA.Green).setLocalTranslation(pos);

 arrow = new Arrow(Vector3f.UNIT_Z);
 arrow.setLineWidth(4); // make arrow thicker
 putShape(arrow, ColorRGBA.Blue).setLocalTranslation(pos);
 }

private Geometry putShape(Mesh shape, ColorRGBA color) {
 Geometry g = new Geometry("coordinate axis", shape);
 Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
 mat.getAdditionalRenderState().setWireframe(true);
 mat.setColor("Color", color);
 g.setMaterial(mat);
 rootNode.attachChild(g);
 return g;
 }