Path cost jumps on polygon boundaries
On seeing some more unexpected pathfinding results, I've done some more in depth testing and found that the path cost calculations are generating wildly differing values when the start/end is moved across nav polygon (not tile) boundaries.
In the image above, the testing actor gives a path cost of 90 and pathfinding steps of 0. When moving one or both endpoints a tiny distance onto the next polygon, the pathfinding steps will jump up to 2 or 3, and with each jump, the path cost also jumps up, by around a further 90 each time. Note that the drawn path remains a simple, straight line.
I don't know the code, but my assumption is that pathfinding steps is a measure of the searching algorithm and shouldn't have any direct bearing on the actual cost in a gameplay sense, yet it appears that it does. So I'm guessing there's a bug in there somewhere.
Note that this is not merely limited to the output results of the navigation testing actor. It is leading to incorrect pathing in practice. In the below image, nav polygon edges are aligned with the camera direction, so the direct path crosses a couple of them, which is bumping up the calculated cost enough that the cost of going via my custom links as shown is actually lower.
asked Apr 28 '17 at 04:39 AM in Using UE4
This behavior is a side effect of how Recast is finding paths - the pathing distance is measured between centers of portal edges (edges shared by two polygons). Path string-pulling is done as a post-processing step (and is optional). The behavior you observe depends heavily on navmesh's triangulation, so you can try different triangulation methods and see if it helps. Also, playing around with area costs usually helps a lot here .
answered Jul 20 '17 at 09:42 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here