Hi
I am adding to a PointGraph some nodes and their connections to other nodes.
Searching a path from a node to another node works very well.
So far so good.
The problem is the result in OnPathComplete(Pathfinding.Path p).
I am getting only the positions of the result path. Is there a way to get the index number of the nodes which are part of the result path? The index number of a node in the result path MUST be the same index number of this node in the PointGraph.
Currently i am doing it this way:
int numPositions = p.vectorPath.Count;
for (int i = 0; i < (numPositions - 1); i++)
{
var nodeStart = AstarPath.active.GetNearest(p.vectorPath[i]).node;
var nodeEnd = AstarPath.active.GetNearest(p.vectorPath[i + 1]).node;
int nodeStartIndex = nodeStart.NodeIndex;
int nodeEndIndex = nodeEnd.NodeIndex;
}
Is this correct?
Greetings
Thomas