Merge pull request #67939 from sambriels/emit-signal-after-target-reached

[NavigationAgent2D/3D]: target_reached signal is emitted before internal state is updated
This commit is contained in:
Clay John 2022-10-27 12:52:13 -07:00 committed by GitHub
commit 4dc2c8ae6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -478,8 +478,8 @@ void NavigationAgent2D::_request_repath() {
void NavigationAgent2D::_check_distance_to_target() {
if (!target_reached) {
if (distance_to_target() < target_desired_distance) {
emit_signal(SNAME("target_reached"));
target_reached = true;
emit_signal(SNAME("target_reached"));
}
}
}

View File

@ -495,8 +495,8 @@ void NavigationAgent3D::_request_repath() {
void NavigationAgent3D::_check_distance_to_target() {
if (!target_reached) {
if (distance_to_target() < target_desired_distance) {
emit_signal(SNAME("target_reached"));
target_reached = true;
emit_signal(SNAME("target_reached"));
}
}
}