Hi! I’m using A* Pathfinding Pro with a Recast graph, and I’m seeing really weird paths returned. I think the problem is that Recast generates very big polygons in the graph, and then path through the centers of the polygons is very far from optimal. I thought that reducing Max Edge Length would force Recast to generate smaller polygons, but apparently I’m mistaken, or the Recast setting is broken. Here’s an illustration: https://i.imgur.com/1G8sIp8.png

The path in the image does not use any postprocessors - that is intentional, because they would mask the problem. A funnel or raycast mod would straighten the path in the example, but move the target a bit to the left - and crooked path becomes long enough that A* prefers looping around the tree to the right - which look OBVIOUSLY wrong and cannot be fixed with any modifier.

What can I do in this case?

Hi

Yeah, a funnel modifier should be used when you are using a navmesh based graph.

The max edge length can only affect edges on the border of the navmesh, not inner edges. The optimal triangles are equilateral and the triangles do not vary widely in size, try to adjust the max edge length so that they are as equilateral as possible.

Yes, it is possible to get suboptimal paths to be calculated unfortunately. Improving this would require some algorithms that are not implemented in this system (like Theta*). What you can do is reduce the tile size of the recast graph, that will split up large triangles into smaller ones which (usually) reduces the risk of such suboptimal paths being calculated but does lead to a small increase in path calculation time and scanning time.

In your case I would also recommend increasing the ‘Max Edge Error’ field a bit since it looks like your navmesh contains some unnecessary edge detail in some places.

Thanks, reducing tile size dramatically (128->20) helped. Graph building takes a lot of time on these settings, but that we can live with.