HexGrid
| Quick facts | |
|---|---|
| Grid | HexGrid |
| CellType | HexCellType |
| CellDir | PTHexDir / FTHexDir |
| CellRotation | HexRotation |
| Bound | HexBound |
| Properties | 2d, Planar, Repeating, Infinite |
HexGrid is a tiling of the plane with hexagons. It supports both flat-topped and pointy topped varieties.
Cell co-ordinates
The co-ordinate systems used are shown above - it uses three co-ordinates that always sum to zero. This scheme is explained in more detail by Red Blob Games.
Cell (0, 0, 0) has its center at new Vector3(0, 0, 0).
Subdivision into triangles
HexGrid comes with extra methods to help subdivide each hex into six of the triangles found on a corresponding triangle grid.
GetChildTriangleGrid
Returns the triangle grid that subdivides this grid.
GetChildTriangles
Returns the cells for the 6 triangles in the child triangle grid that fill up this hex cell.
GetTriangleParent
Returns the hex cell that contains the triangle cell passed in.