diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/math/a_star.cpp | 8 | ||||
-rw-r--r-- | core/math/a_star.h | 2 | ||||
-rw-r--r-- | core/variant_call.cpp | 1 |
3 files changed, 6 insertions, 5 deletions
diff --git a/core/math/a_star.cpp b/core/math/a_star.cpp index c327f7ca44..7e061359fc 100644 --- a/core/math/a_star.cpp +++ b/core/math/a_star.cpp @@ -86,7 +86,7 @@ void AStar::remove_point(int p_id) { points.erase(p_id); } -void AStar::connect_points(int p_id, int p_with_id) { +void AStar::connect_points(int p_id, int p_with_id, bool bidirectional) { ERR_FAIL_COND(!points.has(p_id)); ERR_FAIL_COND(!points.has(p_with_id)); @@ -95,7 +95,9 @@ void AStar::connect_points(int p_id, int p_with_id) { Point *a = points[p_id]; Point *b = points[p_with_id]; a->neighbours.push_back(b); - b->neighbours.push_back(a); + + if (bidirectional) + b->neighbours.push_back(a); Segment s(p_id, p_with_id); if (s.from == p_id) { @@ -401,7 +403,7 @@ void AStar::_bind_methods() { ClassDB::bind_method(D_METHOD("get_point_weight_scale", "id"), &AStar::get_point_weight_scale); ClassDB::bind_method(D_METHOD("remove_point", "id"), &AStar::remove_point); - ClassDB::bind_method(D_METHOD("connect_points", "id", "to_id"), &AStar::connect_points); + ClassDB::bind_method(D_METHOD("connect_points", "id", "to_id"), &AStar::connect_points, DEFVAL(true)); ClassDB::bind_method(D_METHOD("disconnect_points", "id", "to_id"), &AStar::disconnect_points); ClassDB::bind_method(D_METHOD("are_points_connected", "id", "to_id"), &AStar::are_points_connected); diff --git a/core/math/a_star.h b/core/math/a_star.h index b9c8833386..34a5358344 100644 --- a/core/math/a_star.h +++ b/core/math/a_star.h @@ -105,7 +105,7 @@ public: real_t get_point_weight_scale(int p_id) const; void remove_point(int p_id); - void connect_points(int p_id, int p_with_id); + void connect_points(int p_id, int p_with_id, bool bidirectional = true); void disconnect_points(int p_id, int p_with_id); bool are_points_connected(int p_id, int p_with_id) const; diff --git a/core/variant_call.cpp b/core/variant_call.cpp index 8bc9f085ad..df81d2111e 100644 --- a/core/variant_call.cpp +++ b/core/variant_call.cpp @@ -1460,7 +1460,6 @@ void register_variant_methods() { ADDFUNC1(VECTOR3, BASIS, Vector3, outer, VECTOR3, "b", varray()); ADDFUNC0(VECTOR3, BASIS, Vector3, to_diagonal_matrix, varray()); ADDFUNC0(VECTOR3, VECTOR3, Vector3, abs, varray()); - ADDFUNC0(VECTOR3, VECTOR3, Vector3, abs, varray()); ADDFUNC0(VECTOR3, VECTOR3, Vector3, floor, varray()); ADDFUNC0(VECTOR3, VECTOR3, Vector3, ceil, varray()); ADDFUNC1(VECTOR3, REAL, Vector3, distance_to, VECTOR3, "b", varray()); |