Skip to content

Commit

Permalink
Merge pull request #78173 from smix8/navregion_rot_warning_4.x
Browse files Browse the repository at this point in the history
Add NavigationRegion rotation warning
  • Loading branch information
akien-mga committed Jun 13, 2023
2 parents ad935c4 + 4d8553f commit 2b373f7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions modules/navigation/nav_region.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,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::rad_to_deg(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

Vector<Vector3> vertices = mesh->get_vertices();
int len = vertices.size();
if (len == 0) {
Expand Down

0 comments on commit 2b373f7

Please sign in to comment.