diff --git a/scene/2d/navigation_agent_2d.cpp b/scene/2d/navigation_agent_2d.cpp index c69839603..b7d8e7701 100644 --- a/scene/2d/navigation_agent_2d.cpp +++ b/scene/2d/navigation_agent_2d.cpp @@ -826,6 +826,11 @@ void NavigationAgent2D::update_navigation() { nav_path_index -= 1; navigation_finished = true; target_position_submitted = false; + if (avoidance_enabled) { + Navigation2DServer::get_singleton()->agent_set_position(agent, agent_parent->get_global_position()); + Navigation2DServer::get_singleton()->agent_set_velocity(agent, Vector2(0.0, 0.0)); + Navigation2DServer::get_singleton()->agent_set_velocity_forced(agent, Vector2(0.0, 0.0)); + } emit_signal("navigation_finished"); break; } diff --git a/scene/3d/navigation_agent.cpp b/scene/3d/navigation_agent.cpp index 1c5b762de..1c2758abf 100644 --- a/scene/3d/navigation_agent.cpp +++ b/scene/3d/navigation_agent.cpp @@ -808,6 +808,11 @@ void NavigationAgent::update_navigation() { nav_path_index -= 1; navigation_finished = true; target_position_submitted = false; + if (avoidance_enabled) { + NavigationServer::get_singleton()->agent_set_position(agent, agent_parent->get_global_transform().origin); + NavigationServer::get_singleton()->agent_set_velocity(agent, Vector3(0.0, 0.0, 0.0)); + NavigationServer::get_singleton()->agent_set_velocity_forced(agent, Vector3(0.0, 0.0, 0.0)); + } emit_signal("navigation_finished"); break; }