summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorClay John <claynjohn@gmail.com>2022-10-27 12:52:13 -0700
committerGitHub <noreply@github.com>2022-10-27 12:52:13 -0700
commit4dc2c8ae6fe954f8c5c6627803f0a087ee1a2488 (patch)
tree840ad914ff277029bbd0d7864b1f13be1923358c /scene
parent24e788e9bea4a617dfa5c5879b8f3cd7b2491c9a (diff)
parent815231943b562a252b627c6c72413d119140a9f4 (diff)
Merge pull request #67939 from sambriels/emit-signal-after-target-reached
[NavigationAgent2D/3D]: target_reached signal is emitted before internal state is updated
Diffstat (limited to 'scene')
-rw-r--r--scene/2d/navigation_agent_2d.cpp2
-rw-r--r--scene/3d/navigation_agent_3d.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/scene/2d/navigation_agent_2d.cpp b/scene/2d/navigation_agent_2d.cpp
index f077f7f5e6..d345078c12 100644
--- a/scene/2d/navigation_agent_2d.cpp
+++ b/scene/2d/navigation_agent_2d.cpp
@@ -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"));
}
}
}
diff --git a/scene/3d/navigation_agent_3d.cpp b/scene/3d/navigation_agent_3d.cpp
index 39068fe83c..f64cabb75c 100644
--- a/scene/3d/navigation_agent_3d.cpp
+++ b/scene/3d/navigation_agent_3d.cpp
@@ -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"));
}
}
}