Enforce partial sections of a previous path. (Grid Graph)

Hello all,

I hope you guys can help me with my problem:

Problem:

I have a original path and I add an obstacle that cannot be passed. This generates a path with a new length (to avoid the obstacle). However, sections of the path are adjusted that would not need to be adjusted (because they do not affect the length of the path). How would you proceed to preserve subsections of a path when recalculating a path?

Here is a concrete example (please see attachment):

Image A: I have an origin path with the length of 9.
Image B: I add one non-traversable object on the prior path. The new path avoids the obstacle and has a length of 11.
Image C: This is what I want to achieve: The newly generated path that avoids the obstacle should use as many subsections of the previous path (the one in Image A) as possible, if this does not affect the length of the new path (compared to B).

Thanks in advance and I appreciate any help :slight_smile:

Hi

Those two paths have an identical length so the pathfinding system doesn’t have a preference between them. You could try to set A* Inspector → Settings → Heuristic = Manhattan. That might make it a bit more predictable. Possibly setting the heuristic scale to something like 1.001 could also help slightly, but I don’t think it will be consistent.

1 Like

Hi Aron!

Thanks for the quick reply - I will give it a try :slight_smile: