From 618d9492d9e00c1fb405967e47bb811afa63082a Mon Sep 17 00:00:00 2001 From: smix8 <52464204+smix8@users.noreply.github.com> Date: Mon, 23 Oct 2023 05:10:58 +0200 Subject: [PATCH] Fix missing NavigationObstacle property updates in constructor Fixes missing NavigationObstacle property updates in constructor. --- scene/2d/navigation_obstacle_2d.cpp | 8 ++++---- scene/3d/navigation_obstacle_3d.cpp | 12 +++++------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/scene/2d/navigation_obstacle_2d.cpp b/scene/2d/navigation_obstacle_2d.cpp index d993b8a4002..60fb64a8e2d 100644 --- a/scene/2d/navigation_obstacle_2d.cpp +++ b/scene/2d/navigation_obstacle_2d.cpp @@ -148,10 +148,10 @@ void NavigationObstacle2D::_notification(int p_what) { NavigationObstacle2D::NavigationObstacle2D() { obstacle = NavigationServer2D::get_singleton()->obstacle_create(); - set_radius(radius); - set_vertices(vertices); - set_avoidance_layers(avoidance_layers); - set_avoidance_enabled(avoidance_enabled); + NavigationServer2D::get_singleton()->obstacle_set_radius(obstacle, radius); + NavigationServer2D::get_singleton()->obstacle_set_vertices(obstacle, vertices); + NavigationServer2D::get_singleton()->obstacle_set_avoidance_layers(obstacle, avoidance_layers); + NavigationServer2D::get_singleton()->obstacle_set_avoidance_enabled(obstacle, avoidance_enabled); } NavigationObstacle2D::~NavigationObstacle2D() { diff --git a/scene/3d/navigation_obstacle_3d.cpp b/scene/3d/navigation_obstacle_3d.cpp index 95881b1d5a6..98cd5efef27 100644 --- a/scene/3d/navigation_obstacle_3d.cpp +++ b/scene/3d/navigation_obstacle_3d.cpp @@ -167,13 +167,11 @@ NavigationObstacle3D::NavigationObstacle3D() { obstacle = NavigationServer3D::get_singleton()->obstacle_create(); NavigationServer3D::get_singleton()->obstacle_set_height(obstacle, height); - - set_radius(radius); - set_height(height); - set_vertices(vertices); - set_avoidance_layers(avoidance_layers); - set_avoidance_enabled(avoidance_enabled); - set_use_3d_avoidance(use_3d_avoidance); + NavigationServer3D::get_singleton()->obstacle_set_radius(obstacle, radius); + NavigationServer3D::get_singleton()->obstacle_set_vertices(obstacle, vertices); + NavigationServer3D::get_singleton()->obstacle_set_avoidance_layers(obstacle, avoidance_layers); + NavigationServer3D::get_singleton()->obstacle_set_use_3d_avoidance(obstacle, use_3d_avoidance); + NavigationServer3D::get_singleton()->obstacle_set_avoidance_enabled(obstacle, avoidance_enabled); #ifdef DEBUG_ENABLED NavigationServer3D::get_singleton()->connect("avoidance_debug_changed", callable_mp(this, &NavigationObstacle3D::_update_fake_agent_radius_debug));