A* Pathfinding Project

How to get the vertices/corners of hexagon grid nodes


Is there an easy way to get the vertices/corner positions of nodes in a hexagon grid? I’m creating a tbg and I need some way to draw graphics in game for the hexagons that is avaialable for movement. (the gameobject solution in the turnbased example is not an option, since my map is using heights). My plan is to use a linerenderer to draw hexagons with the node corner positions.




Currently there is not unfortunately.
However you can take a look at the code that the grid graph uses to draw them in the scene view. It is the GridGraph.CreateNavmeshSurfaceVisualization method. That one draws both the surface and the outline.


Ok I will have a look. Btw I tried the beta method getcontours. Its nice but not what I want (it also doesnt work together with constantpath if you dont reach any edge of the grid.)

Anyway - there really should be a getNodeContours method also. Consider it a feature request!


Won’t GetContours for each individual node work though? If you just give the GetContours method a single node at a time then it would output the outline for that node.
It wouldn’t have the same height information as the CreateNavmeshSurfaceVisualization method uses though.


Great site about hexagonal grids: https://www.redblobgames.com/grids/hexagons/


A bit late, but this bug has been fixed in 4.1.10 btw.