Odd that you are seeing this in 4.x. I would have expected the exact same behavior in 3.x with those settings. Though some of those paths do look very strange.
Do you happen to have a screenshot of the graph when using 3.x?
The reason this happens is because pathfinding is done on nodes which are the centers of the triangles in that navmesh. This can sometimes result in suboptimal paths being calculated. If you use the RichAI movement script it has an option for ‘funnel simplification’ which tries to post-process the path to make it straighter and that usually fixes problems like these (I have not yet ported that algorithm to the FunnelModifier unfortunately).
The other option which could work in your case is increasing the tile size. This will remove a lot of those ‘heavy knots’ as you call them (I assume you are talking about the tile corners).
Our leveldesigner says he tried to increase tile size once and those knots got worse, but we can try to fiddle around with those settings a little bit more.
Here are two screenshots displaying quite well the somewhat strange behaviour of the funnel component
Both movements seem to use the same underlying path with quite different results from the funnel component…
Ah. That definitely looks buggy. I will investigate.
I am however at the moment reworking the funnel modifier, so right now in the beta it is even more broken (this is mentioned in the changelog). I will get back to you when I have some more results.
I am however going to be away for about a week, so I am not sure how quickly I can take a look at this.
One thing you could try is to copy the FunnelModifier.cs script from the 3.x version to the 4.x version and see if that resolves the bug. I think it should still compile.
Regarding the navmesh knots. To me it looks like the navmesh in 3.x is very similar to the one in 4.x.
If you disable ‘show node connections’ in the 3.x settings and enable ‘Show Surface’ in the 4.x settings (or some other combination) they should look very similar (except the colors potentially).
Just so that you didn’t just toggle ‘unwrap’ quickly while the game was running. The funnel modifier only runs when a path is calculated (which is probably not every frame) so the effect of toggling ‘unwrap’ will not show up until the next path is calculated.
If you get the same detours as in this image:
Then it is definitely still buggy. That screenshot is definitely still buggy while the first one that you posted:
is not necessarily buggy, or at least it has nothing to do with the funnel modifier. Just an unfortunate consequence of how pathfinding on navmesh-based graphs work.
Yeah, there is not much documentation about what it does and how it differs from what the funnel modifier does at the moment. This picture illustrates it quite well:
For both the red and the green path, the funnel modifier has been applied. However in the red case the path cannot be simplified as much as in the green case because it passes through the wrong nodes.
The path that the funnel modifier returns must pass through the same nodes as the path originally traversed.
Yeah, unfortunately the 3.x funnel modifier gives the same weird results.
We had some spots were we got zickzack routes using 3.x but not as bad as now.
Do you know another approach to clean those spots in some way?
It’s from your scene PenaltiesExample, I was trying many different things because of I had the AI to go thro obstacles with the raycast simplifier, with the funnel it does not go thro but very often it refuses to go in a straight line when it cans.
This scene takes place on a grid based graph. Im using 4.0.6
@NewTO
For the funnel modifier this is the expected result. The funnel modifier works best on navmesh-graphs, but it also works on grid graphs. The image below explains how the funnel modifier works on grid graphs. The reason there is still a bend in the path is because the simplification is constrained to still be within the nodes that the path originally visited.
I would recommend the raycast simplifier for grid graphs. Try with ‘raycasting’ disabled and ‘graph raycasting’ enabled. One thing you might have encountered is that ‘graph raycasting’ is a pro-only feature, but in the current release the inspector does not say anything about that (in the beta I have fixed this hwoever) so if you were using the free version this could lead to some confusion as the ‘graph raycasting’ mode would not appear to do anything.
I have found one bug that could potentially be the source of the issue. (I also found 2 other bugs, but I don’t think they are the cause of this).
I have just uploaded a new beta version: 4.1.2. It includes these fixes. Let me know if this changes anything.
In particular if you can replicate the issue in this screenshot: