diff options
Diffstat (limited to 'scene/2d/navigation_obstacle_2d.cpp')
-rw-r--r-- | scene/2d/navigation_obstacle_2d.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/scene/2d/navigation_obstacle_2d.cpp b/scene/2d/navigation_obstacle_2d.cpp index 4bd170301a..d7ef77e25b 100644 --- a/scene/2d/navigation_obstacle_2d.cpp +++ b/scene/2d/navigation_obstacle_2d.cpp @@ -185,6 +185,10 @@ real_t NavigationObstacle2D::estimate_agent_radius() const { } void NavigationObstacle2D::set_agent_parent(Node *p_agent_parent) { + if (parent_node2d == p_agent_parent) { + return; + } + if (Object::cast_to<Node2D>(p_agent_parent) != nullptr) { parent_node2d = Object::cast_to<Node2D>(p_agent_parent); if (map_override.is_valid()) { @@ -200,7 +204,12 @@ void NavigationObstacle2D::set_agent_parent(Node *p_agent_parent) { } void NavigationObstacle2D::set_navigation_map(RID p_navigation_map) { + if (map_override == p_navigation_map) { + return; + } + map_override = p_navigation_map; + NavigationServer2D::get_singleton()->agent_set_map(agent, map_override); } @@ -214,13 +223,23 @@ RID NavigationObstacle2D::get_navigation_map() const { } void NavigationObstacle2D::set_estimate_radius(bool p_estimate_radius) { + if (estimate_radius == p_estimate_radius) { + return; + } + estimate_radius = p_estimate_radius; + notify_property_list_changed(); reevaluate_agent_radius(); } void NavigationObstacle2D::set_radius(real_t p_radius) { ERR_FAIL_COND_MSG(p_radius <= 0.0, "Radius must be greater than 0."); + if (Math::is_equal_approx(radius, p_radius)) { + return; + } + radius = p_radius; + reevaluate_agent_radius(); } |