Node orientation/normal

Hi. I am maintaining custom metadata for nodes in grid (and layered grid) graphs and want to draw some debug information. I am using SolidPlane to draw some info, but cannot get the node’s orientation to match with the grid rendered by the AstarPath inspector. Is there a simple way that I can basically get the shape of the node that is rendered by AstarPath gizmos?

Really quick I want to be able to help here, but I’m a little confused- you’d need the orientation of a single node to match the grid made by the AstarPath? Would the orientation mean much in this context since they’re always square? Let me know and I’ll see what I can learn to help :smiley:

Hi

@tealtxgr I believe @nehvaleem is talking about the normal, or slope, of the surface.

The nodes themselves don’t really have a normal. So this is not exposed anywhere. The graph visualization will instead position the y coordinate of tile corners at the average of all y coordinates of the nodes that touch that corner.

The relevant code is in the GridGraph.CreateNavmeshSurfaceVisualization method.

2 Likes

Ahhhh that makes much more sense. The cons of opening my Astar troubleshooting Unity project where the map is completely flat. I did not take into account a non-flat map haha. Thanks :smiley: