diff options
Diffstat (limited to 'scene/2d/navigation_obstacle_2d.cpp')
-rw-r--r-- | scene/2d/navigation_obstacle_2d.cpp | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/scene/2d/navigation_obstacle_2d.cpp b/scene/2d/navigation_obstacle_2d.cpp index 965e2b6dc1..0a105826c0 100644 --- a/scene/2d/navigation_obstacle_2d.cpp +++ b/scene/2d/navigation_obstacle_2d.cpp @@ -31,7 +31,6 @@ #include "navigation_obstacle_2d.h" #include "scene/2d/collision_shape_2d.h" -#include "scene/2d/physics_body_2d.h" #include "servers/navigation_server_2d.h" void NavigationObstacle2D::_bind_methods() { @@ -54,7 +53,7 @@ void NavigationObstacle2D::_notification(int p_what) { } break; case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: { if (parent_node2d) { - NavigationServer2D::get_singleton()->agent_set_position(agent, parent_node2d->get_global_transform().get_origin()); + NavigationServer2D::get_singleton()->agent_set_position(agent, parent_node2d->get_global_position()); } } break; } @@ -69,17 +68,14 @@ NavigationObstacle2D::~NavigationObstacle2D() { agent = RID(); // Pointless } -String NavigationObstacle2D::get_configuration_warning() const { - String warning = Node::get_configuration_warning(); +TypedArray<String> NavigationObstacle2D::get_configuration_warnings() const { + TypedArray<String> warnings = Node::get_configuration_warnings(); if (!Object::cast_to<Node2D>(get_parent())) { - if (!warning.is_empty()) { - warning += "\n\n"; - } - warning += TTR("The NavigationObstacle2D only serves to provide collision avoidance to a Node2D object."); + warnings.push_back(TTR("The NavigationObstacle2D only serves to provide collision avoidance to a Node2D object.")); } - return warning; + return warnings; } void NavigationObstacle2D::update_agent_shape() { @@ -96,13 +92,13 @@ void NavigationObstacle2D::update_agent_shape() { // and add the enclosing shape radius r += cs->get_shape()->get_enclosing_radius(); } - Size2 s = cs->get_global_transform().get_scale(); + Size2 s = cs->get_global_scale(); r *= MAX(s.x, s.y); // Takes the biggest radius radius = MAX(radius, r); } } - Vector2 s = parent_node2d->get_global_transform().get_scale(); + Vector2 s = parent_node2d->get_global_scale(); radius *= MAX(s.x, s.y); if (radius == 0.0) { |