From 2f1447dfe5ceaccb4a5c574c0a1f76d8cad1c99d Mon Sep 17 00:00:00 2001 From: Relintai Date: Sat, 2 Sep 2023 13:15:19 +0200 Subject: [PATCH] Backported from godot4: Add NavigationRegion rotation warning Adds NavigationRegion rotation warning. - smix8 https://github.com/godotengine/godot/commit/4d8553ff6310c6f4d3c1dc4c9e2118dcd4570ae8 --- modules/navigation/nav_region.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/navigation/nav_region.cpp b/modules/navigation/nav_region.cpp index 13cc357ea..27357b262 100644 --- a/modules/navigation/nav_region.cpp +++ b/modules/navigation/nav_region.cpp @@ -108,10 +108,16 @@ void NavRegion::update_polygons() { return; } +#ifdef DEBUG_ENABLED 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."); } + if (map && Math::rad2deg(map->get_up().angle_to(transform.basis.get_column(1))) >= 90.0f) { + ERR_PRINT_ONCE("Navigation map synchronization error. Attempted to update a navigation region transform rotated 90 degrees or more away from the current navigation map UP orientation."); + } +#endif // DEBUG_ENABLED + PoolVector vertices = mesh->get_vertices(); int len = vertices.size(); if (len == 0) {