summaryrefslogtreecommitdiff
path: root/scene/2d/navigation_obstacle_2d.h
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-11-03 10:13:53 +0100
committerGitHub <noreply@github.com>2021-11-03 10:13:53 +0100
commit87ddc5bbbf66df8a977d6e6c776d36ad852a5930 (patch)
treedff888f8686b0780b05384564331efd670985774 /scene/2d/navigation_obstacle_2d.h
parent8f308bec25ac247ad2ac8b753a1d0558903b6dda (diff)
parentfa26fb865ff1c1f6a107b45717c435e36abaa0e2 (diff)
Merge pull request #54104 from Scony/improve-navigation-obstacles
Improve NavigationObstacle3D usability
Diffstat (limited to 'scene/2d/navigation_obstacle_2d.h')
-rw-r--r--scene/2d/navigation_obstacle_2d.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/scene/2d/navigation_obstacle_2d.h b/scene/2d/navigation_obstacle_2d.h
index 9cffc2c0c3..a5603f059f 100644
--- a/scene/2d/navigation_obstacle_2d.h
+++ b/scene/2d/navigation_obstacle_2d.h
@@ -40,8 +40,12 @@ class NavigationObstacle2D : public Node {
Node2D *parent_node2d = nullptr;
RID agent;
+ bool estimate_radius = true;
+ real_t radius = 1.0;
+
protected:
static void _bind_methods();
+ void _validate_property(PropertyInfo &p_property) const override;
void _notification(int p_what);
public:
@@ -52,10 +56,21 @@ public:
return agent;
}
+ void set_estimate_radius(bool p_estimate_radius);
+ bool is_radius_estimated() const {
+ return estimate_radius;
+ }
+ void set_radius(real_t p_radius);
+ real_t get_radius() const {
+ return radius;
+ }
+
TypedArray<String> get_configuration_warnings() const override;
private:
- void update_agent_shape();
+ void initialize_agent();
+ void reevaluate_agent_radius();
+ real_t estimate_agent_radius() const;
};
#endif