skip to Main Content

Hexagonal Grid and Path Finding API

map.GenerateGrid(): generated the grid cells. You can call this method is you’re not showing the grid.

map.showHexagonalGrid: shows or hides the hexagonal grid over the globe. It will automatically generate the grid cells.

map.hexaGridUseMask: activates the texture mask when rendering the grid. The mask helps define where a cell can be rendered. It uses the value for the blue channel of the texture as a “height” value.

map.hexaGridMask: the mask texture. This texture must be marked as readable.

map.hexaGridMaskThreshold: the minimum height to render a cell.

map.hexaGridDivisions: a value that determines how many divisions are applied to the initial icosahedron.

map.hexaGridColor: the wireframe color of the grid.

map.hexaGridHighlightEnabled: if the user can select a cell with the pointer.

map.hexaGridHighlightColor: the color for the highlight effect.

map.hexaGridHighlightSpeed: the blinking speed of the highlight effect.

map.lastHighlightedCellIndex: the index of the highlighted cell.

map.lastHighlightedCell: the cell object currently highlighted.

map.cells: the array containing all generated cells.

map.GetCellIndex(cell): gets the cell index of a Cell object.

map.GetCellIndex(localPosition): gets the cell index containing a position on the sphere (position given in local space).

map.GetCellAtWorldPos(worldSpacePosition): gets the cell under a world space position.

map.GetCellNeighbours(cellIndex): gets the neighbours of a given cell.

map.GetCellNeighboursIndices(cellIndex): gets the neighbours indices of a given cell.

map.GetCellSharedEdge(cell1, cell2): gets the 2 points of the grid edge shared by cell 1 and 2.

map.SetCellMaterial(cellIndex, material, temporary): assigns a material to a cell. Can be assigned temporarily which will be erased when other color effects occurs on the cell.

map.SetCellColor(cellIndex, color, temporary): assigns a color to a cell. Can be assigned temporarily which will be erased when other color effects occurs on the cell.

map.SetCellColor(list of cells, color, temporary): assigns a color to a list of cells. Can be assigned temporarily which will be erased when other color effects occurs on the cell.

map.SetCellTexture(cellIndex, texture, temporary): assigns a texture to a cell. Can be assigned temporarily which will be erased when other color effects occurs on the cell.

map.pathFindingHeuristicFormula: the heuristic used to estimate the shorted path to a destination cell.

map.pathFindingSearchLimit: the maximum path for any path obtained with FindPath method.

map.FindPath(cell1, cell2): returns the shorted path beween cell1 and cell2.

map.SetCellCanCross / GetCellCanCross(cellIndex): determines if the cell blocks any path when using FindPath.

map.SetCellNeighbourCost / GetCellNeighbourCost (cellIndex, cost): sets or gets the cost for crossing from cell 1 to cell 2 (being cell 2 a neighbour of cell 1).

map.ClearCell / ClearCells: removes any color or texture from a cell.

map.DestroyCell(cellIndex): removes any color or texture from a cell and also removes the cached geometry.

map.ToggleCell(cellIndex, visible): makes a cell visible or invisible.

map.HideCell / ShowCell(cellIndex): hides/shows any cell.

map.GetWorldSpaceCenter(cellIndex): gets the position in world space coordinates of the cell center.

map.FlyToCell(cellIndex): navigates towards the cell.

map.GetCells(region): returns a list of cells contained by a region.

Back To Top