Closed Cwazywierdo closed 3 months ago
Can you confirm this on 4.2.2? Or 4.1.4? There might have been fixes in the more recent versions
The edge connection margin is not a replacement for missing polygons. It is intended to "glue" together edges that dont have the same edge length or have very small misalignment due to sloppy editor placements. The default 0.25 is already too generous, pushing it to 1.0 basically results in what you see here.
This is not a bug, there are code comments from the original coders that not adding "real" mini-polygons for every single edge connection is an intentional design choice. If you run with the default margin or lower it would add so many mini-polygons that it would affect the pathfinding quality and performance negatively. Very large edge connection "bridges" are not useful in general so will see no support. When an agent needs to repath while in-between real navmesh polygons it has to pick a side and can get stuck when too many path updates are done and the margin is too big relative to the agent speed.
I think what could be done here is to improve the 3D debug visuals to make it more clear that an edge connection is just a virtual edge and nothing more. In 2D the debug visuals visualize this slightly better already.
Tested versions
System information
Godot v4.2.1.stable - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1060 6GB (NVIDIA; 31.0.15.3699) - Intel(R) Core(TM) i5-4690 CPU @ 3.50GHz (4 Threads)
Issue description
When there are two navigation regions connected via
edge_connection_margin
, agents have to leave the nav mesh in order to move from one region to another. When they are outside of the mesh though, they are not restricted to the connecting area (pink), causing them to cut corners.A path where the agent does NOT traverse between regions, and correctly stays within the nav mesh: A path where the agent DOES traverse between regions, and leaves the nav mesh and connecting area;
Steps to reproduce
The following instructions are also viewable inside the MRP:
Ensure that Debug>Visible Navigation is enabled in the editor Press number keys to set nav target 1 - Top Left 2 - Top Right 3 - Bottom Left 4 - Bottom Right
Try pressing 1, then 3 and see how the agents path stays within the nav mesh bounds Then try pressing 4, then 2 to see how the agent leaves the nav mesh at the point where the two regions connect.
Minimal reproduction project (MRP)
Pathfinding Between Regions OOB MRP.zip