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);
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s