summaryrefslogtreecommitdiffstats
path: root/scene/3d/navigation_agent_3d.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-07-03 15:26:11 +0200
committerRémi Verschelde <rverschelde@gmail.com>2023-07-03 15:26:11 +0200
commit813ff4b460eaf73f9cd59d734a7d2cd361313a49 (patch)
treea93072826ce48db53344193f895402684b673101 /scene/3d/navigation_agent_3d.cpp
parent9da070fe054f53647f8ecbd3494e81fd96232aad (diff)
parent34bc410fb419cb002dbe6cd676f0ff54fab5db9c (diff)
downloadredot-engine-813ff4b460eaf73f9cd59d734a7d2cd361313a49.tar.gz
Merge pull request #78857 from smix8/navagent_pos_fix_4.x
Fix NavigationAgent position not always updating
Diffstat (limited to 'scene/3d/navigation_agent_3d.cpp')
-rw-r--r--scene/3d/navigation_agent_3d.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/scene/3d/navigation_agent_3d.cpp b/scene/3d/navigation_agent_3d.cpp
index ba11676225..6ce63d9a4e 100644
--- a/scene/3d/navigation_agent_3d.cpp
+++ b/scene/3d/navigation_agent_3d.cpp
@@ -273,11 +273,13 @@ void NavigationAgent3D::_notification(int p_what) {
} break;
case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
+ if (agent_parent && avoidance_enabled) {
+ NavigationServer3D::get_singleton()->agent_set_position(agent, agent_parent->get_global_position());
+ }
if (agent_parent && target_position_submitted) {
if (velocity_submitted) {
velocity_submitted = false;
if (avoidance_enabled) {
- NavigationServer3D::get_singleton()->agent_set_position(agent, agent_parent->get_global_transform().origin);
if (!use_3d_avoidance) {
stored_y_velocity = velocity.y;
velocity.y = 0.0;