summaryrefslogtreecommitdiff
path: root/scene/3d/navigation_obstacle_3d.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/3d/navigation_obstacle_3d.cpp')
-rw-r--r--scene/3d/navigation_obstacle_3d.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/scene/3d/navigation_obstacle_3d.cpp b/scene/3d/navigation_obstacle_3d.cpp
index daa9222d84..69fd5b02fc 100644
--- a/scene/3d/navigation_obstacle_3d.cpp
+++ b/scene/3d/navigation_obstacle_3d.cpp
@@ -51,10 +51,11 @@ void NavigationObstacle3D::_notification(int p_what) {
Node *p = get_parent();
while (p != nullptr) {
nav = Object::cast_to<Navigation3D>(p);
- if (nav != nullptr)
+ if (nav != nullptr) {
p = nullptr;
- else
+ } else {
p = p->get_parent();
+ }
}
set_navigation(nav);
@@ -93,8 +94,9 @@ NavigationObstacle3D::~NavigationObstacle3D() {
}
void NavigationObstacle3D::set_navigation(Navigation3D *p_nav) {
- if (navigation == p_nav)
+ if (navigation == p_nav) {
return; // Pointless
+ }
navigation = p_nav;
NavigationServer3D::get_singleton()->agent_set_map(agent, navigation == nullptr ? RID() : navigation->get_rid());
@@ -145,8 +147,9 @@ void NavigationObstacle3D::update_agent_shape() {
radius *= MAX(s.x, MAX(s.y, s.z));
}
- if (radius == 0.0)
+ if (radius == 0.0) {
radius = 1.0; // Never a 0 radius
+ }
// Initialize the Agent as an object
NavigationServer3D::get_singleton()->agent_set_neighbor_dist(agent, 0.0);