NavAgent path on nested NavRegions not as optimal as expected

Godot Version

4.5.1

Question

Hi,

iam experimenting with a Gridless Pathfinding System by using NavigationServer2d with its respective Regions.

I am “cutting a Polygon out” from a NavigationRegion to put in another Region with a different movement cost (imagine a road, wich is faster traversable).

1st Question: i would expect the Agent to stay longer in the low movementCost region - do you have an idea why it would leave so fast?

2nd Question: on rectangular Seams (like between the Chunks) the traversal works fine, on sloped seams i need to add an Edge Connection Margin and need to use Edge Connections - what do i do wrong or what did i misunderstood?

Thanks!

Johannes

Hi Johannes!

Maybe the result is not optimal but only approximated.

I am not quite sure how NavigationServer2D’s internals work, but I imagine it translates the 2D regions into a graph of weighted edges and nodes (because both representations are mathematically equivalent, but graphs are more computer-friendly notations). By adding an edge connection you probably force such an edge into the graph.

Kind regards :four_leaf_clover: