Fix bug with pathfinding when previous node is not null
This commit is contained in:
parent
3a1ca0cc3d
commit
f8b3d72292
@ -92,7 +92,7 @@ namespace astar
|
||||
return PathFound(graph, neighborNode, currentNodeEnd, logger);
|
||||
|
||||
float distance = (currentNodeStart.Distance??float.MaxValue) + (float)currentNodeStart.DistanceTo(neighborNode);
|
||||
if (neighborNode.PreviousIsFromStart is null || neighborNode.Distance > distance && currentNodeEnd.PreviousNodeId != neighborId)
|
||||
if (neighborNode.PreviousNodeId is null || neighborNode.Distance > distance)
|
||||
{
|
||||
neighborNode.PreviousNodeId = currentNodeEndId;
|
||||
neighborNode.Distance = distance;
|
||||
|
Loading…
Reference in New Issue
Block a user