summaryrefslogtreecommitdiff
path: root/scene/3d/navigation_obstacle_3d.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-05-19 15:24:34 +0200
committerGitHub <noreply@github.com>2022-05-19 15:24:34 +0200
commitce069fbe9909d72b01b2b0571706773cdad31758 (patch)
treeb6ff71e6534764f22daa3671190a548a72e29a1f /scene/3d/navigation_obstacle_3d.cpp
parentb9bb3de6a1680693f8698926859ee3543422c0f2 (diff)
parent6b51ab66d83b7c85e16189eba280a00ab5ff9536 (diff)
Merge pull request #61128 from smix8/navigation_agent_process_mode_4.x
Diffstat (limited to 'scene/3d/navigation_obstacle_3d.cpp')
-rw-r--r--scene/3d/navigation_obstacle_3d.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/scene/3d/navigation_obstacle_3d.cpp b/scene/3d/navigation_obstacle_3d.cpp
index fa6a633dee..c6eda1f9cd 100644
--- a/scene/3d/navigation_obstacle_3d.cpp
+++ b/scene/3d/navigation_obstacle_3d.cpp
@@ -80,6 +80,26 @@ void NavigationObstacle3D::_notification(int p_what) {
parent_node3d = nullptr;
} break;
+ case NOTIFICATION_PAUSED: {
+ if (parent_node3d && !parent_node3d->can_process()) {
+ map_before_pause = NavigationServer3D::get_singleton()->agent_get_map(get_rid());
+ NavigationServer3D::get_singleton()->agent_set_map(get_rid(), RID());
+ } else if (parent_node3d && parent_node3d->can_process() && !(map_before_pause == RID())) {
+ NavigationServer3D::get_singleton()->agent_set_map(get_rid(), map_before_pause);
+ map_before_pause = RID();
+ }
+ } break;
+
+ case NOTIFICATION_UNPAUSED: {
+ if (parent_node3d && !parent_node3d->can_process()) {
+ map_before_pause = NavigationServer3D::get_singleton()->agent_get_map(get_rid());
+ NavigationServer3D::get_singleton()->agent_set_map(get_rid(), RID());
+ } else if (parent_node3d && parent_node3d->can_process() && !(map_before_pause == RID())) {
+ NavigationServer3D::get_singleton()->agent_set_map(get_rid(), map_before_pause);
+ map_before_pause = RID();
+ }
+ } break;
+
case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
if (parent_node3d && parent_node3d->is_inside_tree()) {
NavigationServer3D::get_singleton()->agent_set_position(agent, parent_node3d->get_global_transform().origin);