Mixed funnel results since 4.0

Hey there again!

I recently upgraded to 4 (running 4.0.10 atm) and since than we experience mixed results, using the funnel component.

It seems like the path is forced along the outlines of the recast mesh, resulting in unpleasing paths.

The navmesh itself looks a little bit strange too, with many heavy knots:

Toggeling wrap/unwrap on the funnel doesn’t seem to have an effect.
Do we need to change settings for the scan and if so were could we start?

Here is a screenshot of the graph settings:

Thanks in advance!


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).

I think i’ve read about the funnel simplification back when implementing A*PP into our project and thought this is what the funnel modifier does.

Here are screenshots of the mesh done with 3.x

Settings are quite the same:

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).

Are you sure disabling ‘unwrap’ does not change anything? Make sure that the path of the agent has time to be recalculated.

Cool, thanks for your effort!
I’ll try to use the 3.x funnel modifier and give feedback.

(also see my other post that I posted something like 5 seconds before you posted yours).

1 Like

wrap/unwrap does not fix the ‘bad’ routes, no.
What do you mean by ‘has time to recalculate’? I only use the path result after the seeker finished

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.

A i see. I’m not sure if wrap/unwrap changes something. Maybe? But in both cases i sometimes get those detours.

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?

Hello there,
I have a similar problem here

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

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.


Just so you know I am still investigating the issue. I have been away for a bit during the last week so I haven’t been able to work that much on it.

Hey, I’m a colleague of Grille, who’s doing a baby-break at the moment. :slight_smile:

May I ask if there is any progress at this topic? It still affects our current builds and we’re curious to know how to proceed.


Hi @sanatobium

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: