I am using point graph for my game. If I know a node how do I find several nearest nodes to it?
Hi
Like this:
`
GraphNode node = AstarPath.active.GetNearest (transform.position).node;
Debug.Log ("Found a node at " + ((Vector3)node.Position));
`
How do I find more than 1 near by nodes?
I want my enemy units to surround my hero and attack him. So I need to know near by positions around him. More than 1.
You can get the neighbours of a node using
GraphNode node = some node; List<GraphNode> neighbours = new List<GraphNode>(); node.GetConnections (neighbours);
Otherwise the easiest method is probably to just get the nearest node for a number of points around the character.