问题
there is my astar algorithm, But I don't know how to get parent and get a quick route from the Destination.
Node script methods
getPos() (Vector2)
Parent (Node)
Node n = ?.Parent;
while(n != null)
{
path.add(n.getPos());
n = n.Parent;
}
回答1:
You have to set "current" as parent to the adjacent nodes. Then if the destination is found, you follow the path of the parent entries, this is the path
EDIT: Also i can´t see a "cost" implementation ...
来源:https://stackoverflow.com/questions/46565789/astar-parent-getpath