1
0
mirror of https://github.com/godotengine/godot.git synced 2025-12-06 17:25:19 +00:00

Make navigation mesh edge connections optional

Makes navigation mesh edge connections optional.
This commit is contained in:
smix8
2023-04-01 01:49:43 +02:00
parent fd4a06c515
commit f986b52b3c
23 changed files with 230 additions and 2 deletions

View File

@@ -69,6 +69,14 @@ void NavMap::set_cell_size(real_t p_cell_size) {
regenerate_polygons = true;
}
void NavMap::set_use_edge_connections(bool p_enabled) {
if (use_edge_connections == p_enabled) {
return;
}
use_edge_connections = p_enabled;
regenerate_links = true;
}
void NavMap::set_edge_connection_margin(real_t p_edge_connection_margin) {
if (edge_connection_margin == p_edge_connection_margin) {
return;
@@ -751,7 +759,9 @@ void NavMap::sync() {
_new_pm_edge_merge_count += 1;
} else {
CRASH_COND_MSG(E.value.size() != 1, vformat("Number of connection != 1. Found: %d", E.value.size()));
free_edges.push_back(E.value[0]);
if (use_edge_connections && E.value[0].polygon->owner->get_use_edge_connections()) {
free_edges.push_back(E.value[0]);
}
}
}