How to create a Custom Mesh Grid of lines

Hello,



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



[java]



gridMesh.setMode(Mode.Lines);



[/java]



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

0 1 2

| | |

3 4 5

| | |

6 7 8

and



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.



Thanks,

Equi

Why not using the grid primitive?

use



import com.jme3.scene.debug.Grid;





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

grid.setMode(Mode.Lines);



It does exactly what you want