A* Pathfinding Project

Entity acknowledges impossible path as possible


#1

I have a problem where the PathFinding detects impossible paths as possible. It causes destinations to be set behind completely warded off locations (I couldn’t get another screenshot in, but it very often places the destination in a different ‘room’ that should be completely blocked off aswell) and even on obstacles themselves (as shown in the screenshot).

For context: I have an enemy that checks if a path is valid between 2 circles, if it fails repeatedly, it makes the circles smaller, and tries again.

Knipsel


#2

Hi

I notice that when you set ai.destination you set it to initialPosition + newPos, but when you call GetNearest you use only newPos. One of them is probably incorrect.


#3

Yes! That was the problem :D, I have no idea how I missed that. Thanks for the help, much appreciated.