Emit target_reached signal after state is updated

This commit is contained in:
Sam Briels 2022-10-27 10:17:10 +02:00
parent 03e5de37ae
commit 815231943b
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"));
}
}
}