Expose NavigationObstacle2D/3D get_rid() and add config warning
Exposes get_rid() function for scripting. Adds configuration warning when obstacle is used with not intended static body parent.
This commit is contained in:
parent
0841f72c38
commit
001d89223f
4 changed files with 32 additions and 1 deletions
|
|
@ -31,10 +31,13 @@
|
|||
#include "navigation_obstacle_2d.h"
|
||||
|
||||
#include "scene/2d/collision_shape_2d.h"
|
||||
#include "scene/2d/physics_body_2d.h"
|
||||
#include "scene/resources/world_2d.h"
|
||||
#include "servers/navigation_server_2d.h"
|
||||
|
||||
void NavigationObstacle2D::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_rid"), &NavigationObstacle2D::get_rid);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_estimate_radius", "estimate_radius"), &NavigationObstacle2D::set_estimate_radius);
|
||||
ClassDB::bind_method(D_METHOD("is_radius_estimated"), &NavigationObstacle2D::is_radius_estimated);
|
||||
ClassDB::bind_method(D_METHOD("set_radius", "radius"), &NavigationObstacle2D::set_radius);
|
||||
|
|
@ -103,6 +106,11 @@ TypedArray<String> NavigationObstacle2D::get_configuration_warnings() const {
|
|||
warnings.push_back(RTR("The NavigationObstacle2D only serves to provide collision avoidance to a Node2D object."));
|
||||
}
|
||||
|
||||
if (Object::cast_to<StaticBody2D>(get_parent())) {
|
||||
warnings.push_back(RTR("The NavigationObstacle2D is intended for constantly moving bodies like CharacterBody2D or RigidDynamicBody2D as it creates only an RVO avoidance radius and does not follow scene geometry exactly."
|
||||
"\nNot constantly moving or complete static objects should be captured with a refreshed NavigationPolygon so agents can not only avoid them but also move along those objects outline at high detail"));
|
||||
}
|
||||
|
||||
return warnings;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue