summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-06-10 12:11:00 +0200
committerRémi Verschelde <rverschelde@gmail.com>2023-06-10 12:11:00 +0200
commit20bf10d15b912ad4e8d0167251cdad9b32d817a9 (patch)
tree9c594561207fe9b24a153643a57ba7c8d588367b
parentc3a45e771b3ec3661c4cd717b62c8bb725c7835f (diff)
parent7f2417135f75b1bb48d570db41e2127c9585238a (diff)
downloadredot-engine-20bf10d15b912ad4e8d0167251cdad9b32d817a9.tar.gz
Merge pull request #77714 from smix8/navmap_error_msgs_4.x
Improve navigation map synchronisation error msgs
-rw-r--r--modules/navigation/nav_map.cpp2
-rw-r--r--modules/navigation/nav_region.cpp4
2 files changed, 5 insertions, 1 deletions
diff --git a/modules/navigation/nav_map.cpp b/modules/navigation/nav_map.cpp
index 37e0f232e5..9a16ee15cf 100644
--- a/modules/navigation/nav_map.cpp
+++ b/modules/navigation/nav_map.cpp
@@ -742,7 +742,7 @@ void NavMap::sync() {
connections[ek].push_back(new_connection);
} else {
// The edge is already connected with another edge, skip.
- ERR_PRINT_ONCE("Attempted to merge a navigation mesh triangle edge with another already-merged edge. This happens when the current `cell_size` is different from the one used to generate the navigation mesh. This will cause navigation problems.");
+ ERR_PRINT_ONCE("Navigation map synchronization error. Attempted to merge a navigation mesh polygon edge with another already-merged edge. This is usually caused by crossing edges, overlapping polygons, or a mismatch of the NavigationMesh / NavigationPolygon baked 'cell_size' and navigation map 'cell_size'.");
}
}
}
diff --git a/modules/navigation/nav_region.cpp b/modules/navigation/nav_region.cpp
index d0f055874e..357ee80d42 100644
--- a/modules/navigation/nav_region.cpp
+++ b/modules/navigation/nav_region.cpp
@@ -105,6 +105,10 @@ void NavRegion::update_polygons() {
return;
}
+ if (!Math::is_equal_approx(double(map->get_cell_size()), double(mesh->get_cell_size()))) {
+ ERR_PRINT_ONCE("Navigation map synchronization error. Attempted to update a navigation region with a navigation mesh that uses a different `cell_size` than the `cell_size` set on the navigation map.");
+ }
+
Vector<Vector3> vertices = mesh->get_vertices();
int len = vertices.size();
if (len == 0) {