|
@@ -100,12 +100,18 @@ void NavRegion3D::set_transform(Transform3D p_transform) {
|
|
|
|
|
|
void NavRegion3D::set_navigation_mesh(Ref<NavigationMesh> p_navigation_mesh) {
|
|
|
#ifdef DEBUG_ENABLED
|
|
|
- if (map && p_navigation_mesh.is_valid() && !Math::is_equal_approx(double(map->get_cell_size()), double(p_navigation_mesh->get_cell_size()))) {
|
|
|
- ERR_PRINT_ONCE(vformat("Attempted to update a navigation region with a navigation mesh that uses a `cell_size` of %s while assigned to a navigation map set to a `cell_size` of %s. The cell size for navigation maps can be changed by using the NavigationServer map_set_cell_size() function. The cell size for default navigation maps can also be changed in the ProjectSettings.", double(p_navigation_mesh->get_cell_size()), double(map->get_cell_size())));
|
|
|
- }
|
|
|
-
|
|
|
- if (map && p_navigation_mesh.is_valid() && !Math::is_equal_approx(double(map->get_cell_height()), double(p_navigation_mesh->get_cell_height()))) {
|
|
|
- ERR_PRINT_ONCE(vformat("Attempted to update a navigation region with a navigation mesh that uses a `cell_height` of %s while assigned to a navigation map set to a `cell_height` of %s. The cell height for navigation maps can be changed by using the NavigationServer map_set_cell_height() function. The cell height for default navigation maps can also be changed in the ProjectSettings.", double(p_navigation_mesh->get_cell_height()), double(map->get_cell_height())));
|
|
|
+ if (map && p_navigation_mesh.is_valid() && GLOBAL_GET_CACHED(bool, "navigation/3d/warnings/navmesh_cell_size_mismatch")) {
|
|
|
+ const double map_cell_size = double(map->get_cell_size());
|
|
|
+ const double map_cell_height = double(map->get_cell_height());
|
|
|
+ const double navmesh_cell_size = double(p_navigation_mesh->get_cell_size());
|
|
|
+ const double navmesh_cell_height = double(p_navigation_mesh->get_cell_height());
|
|
|
+
|
|
|
+ if (map_cell_size > navmesh_cell_size) {
|
|
|
+ WARN_PRINT(vformat("A navigation mesh that uses a `cell_size` of %s was assigned to a navigation map set to a larger `cell_size` of %s.\nThis mismatch in cell size can cause rasterization errors with navigation mesh edges on the navigation map.\nThe cell size for navigation maps can be changed by using the NavigationServer map_set_cell_size() function.\nThe cell size for default navigation maps can also be changed in the project settings.\nThis warning can be toggled under 'navigation/3d/warnings/navmesh_cell_size_mismatch' in the project settings.", navmesh_cell_size, map_cell_size));
|
|
|
+ }
|
|
|
+ if (map_cell_height > navmesh_cell_height) {
|
|
|
+ WARN_PRINT(vformat("A navigation mesh that uses a `cell_height` of %s was assigned to a navigation map set to a larger `cell_height` of %s.\nThis mismatch in cell height can cause rasterization errors with navigation mesh edges on the navigation map.\nThe cell height for navigation maps can be changed by using the NavigationServer map_set_cell_height() function.\nThe cell height for default navigation maps can also be changed in the project settings.\nThis warning can be toggled under 'navigation/3d/warnings/navmesh_cell_size_mismatch' in the project settings.", navmesh_cell_height, map_cell_height));
|
|
|
+ }
|
|
|
}
|
|
|
#endif // DEBUG_ENABLED
|
|
|
|