Funnel bug spotted

Hey Aron, would like to show one more bug, related to Funnel Modifier. Currently using 4.1.18, unity 2017.4.0f1

attaching the scene unitypackage (it only has 1 folder with my scene & mesh)

Steps to reproduce:

  1. Open Scene3B.unity (it’s almost empty)

  2. Drag “navmesh_3b” from “Assets/Scene3B” into A* singleton

  3. generate cache for it - my mesh is designed to be located about 100 meters away from zero (don’t ask why :D).

  4. in Hierarchy, select ‘Mover’, press F to focus on it in scene view

  5. Start the game

  6. click on the game-view (I made it so there is no camera to render), press ‘1’ on keyboard. This will place nav agent on location 1. It’s script tells it to move to purple sphere (to target).

  7. observe how the agent will get stuck in “Trapped 1” area. After about 10 seconds it will teleport to world zero.

I checked the mesh in 3ds max, and its vertices overlap fine (at least around the “Trapped 1” region)

  1. The green path line will flicker in the orange circle if the Funnel modifier is on

  2. Click Game view window, press ‘2’ - the navAgent is teleported to location 2. It will move to target, but will get stuck at “Trapped 2” region.

  3. Green line will be flickering again, around orange zone:

Disabling Funnel modifier prevents the agent from being stuck, and lines don’t flicker. However of course, path looks much better if we use Funnel

Hi

I haven’t tested the scene yet, but I wanted to ask: does this only happen if you use caching?

Nope, I tried it with no cache a min ago, and the problems persist

Hey Aron, will there be a fix for the modifier? Perhaps I could adjust my code so the agent doesn’t stuck, how should I do it?

Hi

I’m not quite sure what is going on. My first instinct would be that the vertices do not line up perfectly.
I haven’t had the time to take a look at the project yet (I have a ton of projects going on right now), but I will do so soon.

As for the first screenshot, are you sure the funnel is actually outside the mesh when you look at it from above? The funnel modifier will skip a lot of points in the path that only change the y coordinate unless the setting ‘split at every portal’ is enabled.

The trapping in the first screenshot is not the funnel modifiers fault. The AIPath script follows the path slightly on the inside. You could try to use the RichAI script instead which has some more tweaks for navmesh-based graphs. Among other things it tries to keep a slight distance to the wall to avoid that from happening.