How to create a Custom Mesh Grid of lines


I want to create a custom mesh representing a plane grid (for orientation). I write something like




create x*y points and connect two points each for a line.

0 1 2

| | |

3 4 5

| | |

6 7 8


0 - 1 - 2

3 - 4 - 5

6 - 7 - 8

so, I would get an index array like {0,6,1,7,2,8,0,2,3,5,6,8} (the lines go from top to bottom and left to right)

The reason is, that the grid should look like a grid, so I can not use triangle quads, else I would see the “middle line” in the quad. My question is, if this is the correct way and how picking will be supported by such a mesh construction.



Why not using the grid primitive?


import com.jme3.scene.debug.Grid;

Grid grid = new Grid(10,10,1);//for example


It does exactly what you want