NavigationAgent2D seems to Consider NavigationRegions as obstacles to avoid

Godot Version

Godot 4.3

Question

So, I’m posting this here because I have no idea why this happens and it seems I’ve tried everything I could to make it work, without success.

My agents seem to be avoiding the NavigationRegion2D that is used to path find and prefer to move outside that region whenever they can.

Here is what I noticed:

  • Increasing the agent radius on the NavigationRegion2D makes the problem worse by allowing more “wiggle room” for agents to move outside the navigation region, making the visual bounce worse
  • Lowering the path distance in the Navigation agent helps reducing that problem, but won’t allow for avoidance to function properly in the future
  • In the project’s Debug menu, ticking only “Visible Avoidance” makes my NavigationRegion2D visible (!!!) which seems to indicate that my NavigationRegion is somehow considered to be a NavigationObstacle AND a NavigationRegion
  • The issue disappears when the agent has no choice but to cross inside the navigationregion
  • I had issues with my NavigationRegion2D baking, saying that there was overlap between my polygons (even if I only have one polygon in my scene) my project cell_size and my NavigationRegion cell_size were different, even if they were not. I had to reset it to default and then put it back up to 64 to stop having this message in the debugger and later, after multiple re-bakings, it broke again.
  • If I remove the collison layers of the agent and set one that has no colliders with anything, the agent will often get “inside” the navigationRegion2D, unable to move and vibrating uncontrollably.

Here is what I tried:

  • Disabling avoidance on agents didn’t work, which means it’s not related to that
  • Both of my TileMapLayers have no navigation layers whatsoever and Navigation is disabled
  • Both agents as the child of the navigationregion2D or both under a common parent
  • Changing back my cell_size to 1 in both my project settings and my navigation region
  • Creating another NavigationRegion2D from scratch

I’m fairly new to programming and game deving, so I don’t know if it’s something obvious that I didn’t do, but I don’t think so. I had something that worked well before, I just didn’t know how to start an avoidance function so I wanted to try and use the built in avoidance of the NavigationAgent2d Node.

I’d upload a video showing the behavior, but I’m still to new to attach anything.