Make navigation mesh edge connections optional #75601
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Makes navigation mesh edge connections optional.
Helps with performance issues like #68642
For context, the NavigationServer merges different navigation region either by polygon
edgekey
or byedge connection
.Edgekeys require a "perfect" overlap of edges as their two vertex need to fall into the same map cell. This navigation polygon merge is very quick and in comparison to edge connections costs nearly no performance.
Edge connections on the other hand create connections by checking free edges for distance and angle and project the edges against each other which is a very costly operation for each possible and free edge pair everytime the navigation map changes.
Edge connections are a great tool for small navigation maps and also help especially beginners to get those navigation meshes that have no "perfect" edge overlap to still somehow connect for the pathfinding e.g. because the navigation meshes are sloppy created / placed by hand. Their rather heavy performance cost makes them ill-suited for runtime changes on large navigation maps with many navigation mesh polygon edges so more advanced users struggle with their performance impact.
Edge connections get more and more problematic for performance the larger a navigation map is cause the growing number of unmerged edges need to be compared against each other for a possible edge connection. Also another issue with edge connections is that they are only virtual connections and not real navigation mesh polygons which causes quality problems with point queries and pathfinding / path resets that some users never expect. They make it hard to predict merge behavior at runtime with procedual navigation.
The gist is users might not want to use edge connections for one reason or another so giving users the option to disable edge connections either per navigation region or for the entire navigation map makes sense.