Bug with MultitargetPath around the GridGraph origin

It seems like there is a strange error when using MultiTargetPath near the origin point of a GridGraph.

Here is what the ‘reachable squares’ are when using ConstantPath

code for this looks like:

	constantPath = ConstantPath.Construct(currentStartPosition, moveRange * multiplier, null); // 1066 // 1040 is better

	constantPath.heuristic = heuristic;
	constantPath.heuristicScale = heuristicScale;



This is what it looks like when figuring out a path to each square within the circle sequentially.

with code looking like:

	ABPath p = ABPath.Construct(currentStartPosition, potentialPoints[i]);



but this is what it looks like when I calculate paths using MultiTargetPath

with code:

				mtPath = MultiTargetPath.Construct(currentStartPosition, potentialPoints.ToArray(), delegates);

				mtPath.pathsForAll = true;


Now, I think it’s related to the origin point of the graph (the selected transform in the image above is the origin of a 200x200 grid graph). This is because if I move the obstacles, and re-run the pathfinder, I get the following.

Not sure what is going on, but it seems like a bug (maybe off by one error?)


I don’t quite understand what bug the screenshots are showing. Would you mind elaborating?

The last two screenshots show some missing circles. Those are locations which the pathfinder failed to find a path to(from the dot at the center of the circle) when using MultiTargetPath. The exact same location has a path found when using ConstantPath and regular ABPath.(and all other factors being same. The only difference being the code snippets posted.)

Thanks! I did find a bug specifically for grid graphs.
I’ve added a fix for it, and unit tests to ensure it doesn’t happen again.

The fix will be included in the next update.