GraphAStarExample icon indicating copy to clipboard operation
GraphAStarExample copied to clipboard

Incorrect path calculation for long path after update to 4.27

Open ivasyliev opened this issue 4 years ago • 4 comments

I was trying to use Engine function FindPathToLocationSynchronously and I found the issue that result with Path points are incorrect after engine update. At some point engine call the function AGraphAStarNavMesh::FindPath and this function return path points. If path is longer then X cells (5 in example and 7 in my proj. I think it depends from world distance) then this function return such array [1, 1, 2, 3, .... x]. So start point is there twice.

ivasyliev avatar Sep 13 '21 09:09 ivasyliev

That is interesting, as you can see in GraphAStarNavMesh.cpp at line 179 i manually add the starting node because FGraphAStar::FindPath doesn't add it, or at least is what is always happened to me but i never tested it with FindPathToLocationSynchronously. For some reason sometime when you use FindPathToLocationSynchronously the starting node is counted so we have twice of it after my Add call. I need to go deeper with the debugger to understand why this happen, meanwhile thanks for the heads up!

ZioYuri78 avatar Sep 13 '21 13:09 ZioYuri78

yeah, I read though the code a bit and I've seen your logic. But I didn't found anything obvious, that's why I'm reaching you. I don't know why there is dependency from path length and from engine version. But looks like it was ok in 4.26. thanks for quick response. Let me know if you'll need any support

ivasyliev avatar Sep 13 '21 13:09 ivasyliev

I did a small workaround, it not really solve the issue because i still have to figure out what happen but at least it avoid duplication in paths longers than 7 tiles and it let us move of only 1 tile.

ZioYuri78 avatar Sep 14 '21 15:09 ZioYuri78

Workaround introduced a bug so i had to revert, issue still unresolved.

ZioYuri78 avatar Sep 15 '21 15:09 ZioYuri78