diff --git a/core/math/a_star.cpp b/core/math/a_star.cpp index c056b1c1c35..44e796044c8 100644 --- a/core/math/a_star.cpp +++ b/core/math/a_star.cpp @@ -43,6 +43,7 @@ int AStar::get_available_point_id() const { void AStar::add_point(int p_id, const Vector3 &p_pos, float p_weight_scale) { ERR_FAIL_COND(p_id < 0); + ERR_FAIL_COND(p_weight_scale < 1); if (!points.has(p_id)) { Point *pt = memnew(Point); pt->id = p_id; @@ -221,7 +222,6 @@ bool AStar::_solve(Point *begin_point, Point *end_point) { float cost = p->distance; cost += _estimate_cost(p->id, end_point->id); - cost *= p->weight_scale; if (cost < least_cost) { diff --git a/doc/base/classes.xml b/doc/base/classes.xml index 06d593b3ff7..4335eddd975 100644 --- a/doc/base/classes.xml +++ b/doc/base/classes.xml @@ -2181,6 +2181,7 @@ + Weight scale has to be 1 or larger.