|
@@ -40,6 +40,9 @@ void NavigationAgent::_bind_methods() {
|
|
|
ClassDB::bind_method(D_METHOD("set_avoidance_enabled", "enabled"), &NavigationAgent::set_avoidance_enabled);
|
|
|
ClassDB::bind_method(D_METHOD("get_avoidance_enabled"), &NavigationAgent::get_avoidance_enabled);
|
|
|
|
|
|
+ ClassDB::bind_method(D_METHOD("set_path_desired_distance", "desired_distance"), &NavigationAgent::set_path_desired_distance);
|
|
|
+ ClassDB::bind_method(D_METHOD("get_path_desired_distance"), &NavigationAgent::get_path_desired_distance);
|
|
|
+
|
|
|
ClassDB::bind_method(D_METHOD("set_target_desired_distance", "desired_distance"), &NavigationAgent::set_target_desired_distance);
|
|
|
ClassDB::bind_method(D_METHOD("get_target_desired_distance"), &NavigationAgent::get_target_desired_distance);
|
|
|
|
|
@@ -90,6 +93,7 @@ void NavigationAgent::_bind_methods() {
|
|
|
|
|
|
ClassDB::bind_method(D_METHOD("_avoidance_done", "new_velocity"), &NavigationAgent::_avoidance_done);
|
|
|
|
|
|
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "path_desired_distance", PROPERTY_HINT_RANGE, "0.1,100,0.01"), "set_path_desired_distance", "get_path_desired_distance");
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::REAL, "target_desired_distance", PROPERTY_HINT_RANGE, "0.1,100,0.01"), "set_target_desired_distance", "get_target_desired_distance");
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::REAL, "radius", PROPERTY_HINT_RANGE, "0.1,100,0.01"), "set_radius", "get_radius");
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::REAL, "agent_height_offset", PROPERTY_HINT_RANGE, "-100.0,100,0.01"), "set_agent_height_offset", "get_agent_height_offset");
|
|
@@ -283,6 +287,10 @@ RID NavigationAgent::get_navigation_map() const {
|
|
|
return RID();
|
|
|
}
|
|
|
|
|
|
+void NavigationAgent::set_path_desired_distance(real_t p_dd) {
|
|
|
+ path_desired_distance = p_dd;
|
|
|
+}
|
|
|
+
|
|
|
void NavigationAgent::set_target_desired_distance(real_t p_dd) {
|
|
|
target_desired_distance = p_dd;
|
|
|
}
|
|
@@ -458,7 +466,7 @@ void NavigationAgent::update_navigation() {
|
|
|
// Check if we can advance the navigation path
|
|
|
if (navigation_finished == false) {
|
|
|
// Advances to the next far away location.
|
|
|
- while (o.distance_to(navigation_path[nav_path_index] - Vector3(0, navigation_height_offset, 0)) < target_desired_distance) {
|
|
|
+ while (o.distance_to(navigation_path[nav_path_index] - Vector3(0, navigation_height_offset, 0)) < path_desired_distance) {
|
|
|
nav_path_index += 1;
|
|
|
if (nav_path_index == navigation_path.size()) {
|
|
|
_check_distance_to_target();
|