summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--scene/2d/navigation_region_2d.cpp26
-rw-r--r--scene/3d/navigation_region_3d.cpp12
2 files changed, 19 insertions, 19 deletions
diff --git a/scene/2d/navigation_region_2d.cpp b/scene/2d/navigation_region_2d.cpp
index 706b26bd05..78733f04e4 100644
--- a/scene/2d/navigation_region_2d.cpp
+++ b/scene/2d/navigation_region_2d.cpp
@@ -497,20 +497,18 @@ void NavigationRegion2D::_region_enter_navigation_map() {
return;
}
- if (enabled) {
- if (map_override.is_valid()) {
- NavigationServer2D::get_singleton()->region_set_map(region, map_override);
- for (uint32_t i = 0; i < constrain_avoidance_obstacles.size(); i++) {
- if (constrain_avoidance_obstacles[i].is_valid()) {
- NavigationServer2D::get_singleton()->obstacle_set_map(constrain_avoidance_obstacles[i], map_override);
- }
+ if (map_override.is_valid()) {
+ NavigationServer2D::get_singleton()->region_set_map(region, map_override);
+ for (uint32_t i = 0; i < constrain_avoidance_obstacles.size(); i++) {
+ if (constrain_avoidance_obstacles[i].is_valid()) {
+ NavigationServer2D::get_singleton()->obstacle_set_map(constrain_avoidance_obstacles[i], map_override);
}
- } else {
- NavigationServer2D::get_singleton()->region_set_map(region, get_world_2d()->get_navigation_map());
- for (uint32_t i = 0; i < constrain_avoidance_obstacles.size(); i++) {
- if (constrain_avoidance_obstacles[i].is_valid()) {
- NavigationServer2D::get_singleton()->obstacle_set_map(constrain_avoidance_obstacles[i], get_world_2d()->get_navigation_map());
- }
+ }
+ } else {
+ NavigationServer2D::get_singleton()->region_set_map(region, get_world_2d()->get_navigation_map());
+ for (uint32_t i = 0; i < constrain_avoidance_obstacles.size(); i++) {
+ if (constrain_avoidance_obstacles[i].is_valid()) {
+ NavigationServer2D::get_singleton()->obstacle_set_map(constrain_avoidance_obstacles[i], get_world_2d()->get_navigation_map());
}
}
}
@@ -523,6 +521,8 @@ void NavigationRegion2D::_region_enter_navigation_map() {
}
}
+ NavigationServer2D::get_singleton()->region_set_enabled(region, enabled);
+
queue_redraw();
}
diff --git a/scene/3d/navigation_region_3d.cpp b/scene/3d/navigation_region_3d.cpp
index e03640f6cb..b376a4945e 100644
--- a/scene/3d/navigation_region_3d.cpp
+++ b/scene/3d/navigation_region_3d.cpp
@@ -356,17 +356,17 @@ void NavigationRegion3D::_region_enter_navigation_map() {
return;
}
- if (enabled) {
- if (map_override.is_valid()) {
- NavigationServer3D::get_singleton()->region_set_map(region, map_override);
- } else {
- NavigationServer3D::get_singleton()->region_set_map(region, get_world_3d()->get_navigation_map());
- }
+ if (map_override.is_valid()) {
+ NavigationServer3D::get_singleton()->region_set_map(region, map_override);
+ } else {
+ NavigationServer3D::get_singleton()->region_set_map(region, get_world_3d()->get_navigation_map());
}
current_global_transform = get_global_transform();
NavigationServer3D::get_singleton()->region_set_transform(region, current_global_transform);
+ NavigationServer3D::get_singleton()->region_set_enabled(region, enabled);
+
#ifdef DEBUG_ENABLED
if (NavigationServer3D::get_singleton()->get_debug_navigation_enabled()) {
_update_debug_mesh();