|
@@ -168,7 +168,7 @@ void NavigationAgent2D::_notification(int p_what) {
|
|
} break;
|
|
} break;
|
|
|
|
|
|
case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
|
|
case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
|
|
- if (agent_parent) {
|
|
|
|
|
|
+ if (agent_parent && target_position_submitted) {
|
|
if (avoidance_enabled) {
|
|
if (avoidance_enabled) {
|
|
// agent_position on NavigationServer is avoidance only and has nothing to do with pathfinding
|
|
// agent_position on NavigationServer is avoidance only and has nothing to do with pathfinding
|
|
// no point in flooding NavigationServer queue with agent position updates that get send to the void if avoidance is not used
|
|
// no point in flooding NavigationServer queue with agent position updates that get send to the void if avoidance is not used
|
|
@@ -329,6 +329,7 @@ real_t NavigationAgent2D::get_path_max_distance() {
|
|
|
|
|
|
void NavigationAgent2D::set_target_location(Vector2 p_location) {
|
|
void NavigationAgent2D::set_target_location(Vector2 p_location) {
|
|
target_location = p_location;
|
|
target_location = p_location;
|
|
|
|
+ target_position_submitted = true;
|
|
_request_repath();
|
|
_request_repath();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -413,6 +414,9 @@ void NavigationAgent2D::update_navigation() {
|
|
if (!agent_parent->is_inside_tree()) {
|
|
if (!agent_parent->is_inside_tree()) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+ if (!target_position_submitted) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
if (update_frame_id == Engine::get_singleton()->get_physics_frames()) {
|
|
if (update_frame_id == Engine::get_singleton()->get_physics_frames()) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -519,6 +523,7 @@ void NavigationAgent2D::update_navigation() {
|
|
_check_distance_to_target();
|
|
_check_distance_to_target();
|
|
navigation_path_index -= 1;
|
|
navigation_path_index -= 1;
|
|
navigation_finished = true;
|
|
navigation_finished = true;
|
|
|
|
+ target_position_submitted = false;
|
|
emit_signal(SNAME("navigation_finished"));
|
|
emit_signal(SNAME("navigation_finished"));
|
|
break;
|
|
break;
|
|
}
|
|
}
|