Computed path is not straight, when it can be

Hullo,

I have setup a scene that use the A* Pathfinding Project, things work pretty nicely, but sometimes returned paths are not straight, even when they could be!

I thought the Funnel Modifier would do the job, since the way it works, is to narrow funnel as long as the navigation mesh is convex, path remains straight. I am also using the Simple Smooth modifier, so maybe thats why, i’m not sure though.

Here are some screenshots

Could you give me some insights to “fix” that unexpected result?

Regards

Not many vertices, many inner vertices (vertices not on the border of the navmesh).

When there are inner vertices, there is a possibility that the path generated does not go through the most optimal sequence of triangles (this possibility exists with a lower risk when there are no inner vertices as well, but it doesn’t lead to smoothing issues), the funnel modifier can only optimize the path inside the given sequence of triangles so there are some cases when the path might not be optimal. You can enable “Show Detailed Gizmos” on the Seeker to see the nodes it actually went through.

If you have the pro version, you can also try the RichAI script on which you can enable Funnel Simplification which applies some algorithms to try to post process the path to be more optimal.

Once again thank you, everything is clear to me now.

Hi

You have lots of inner vertices in your navigation mesh, this can confuse the funnel modifier.
If you really want to keep the inner vertices, try to add a raycast modifier as well (and probably use graph raycasting on it).

Thanks for the tips, I’ll try that!

Also, I’m interested in why having so many vertices is bad? Would you mind giving in-depth explanation?

Regards