diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-06-29 13:45:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-29 13:45:17 +0200 |
commit | 1df38f2372ffdcd321ec6e54d7d9af7c9a4a8af3 (patch) | |
tree | 6c7fa060b9d12c2f7fd48620e441746c6f77955e /core/math | |
parent | 52355c638b03ff9316ee3f39e32ac968252489d3 (diff) | |
parent | dc9659a9bf11e151098aed94ce5f6382f2dcca0d (diff) |
Merge pull request #30112 from AgentEnder/master
AStar get_current_point enabled consideration
Diffstat (limited to 'core/math')
-rw-r--r-- | core/math/a_star.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/core/math/a_star.cpp b/core/math/a_star.cpp index 7ce3824505..b61119d8df 100644 --- a/core/math/a_star.cpp +++ b/core/math/a_star.cpp @@ -216,6 +216,8 @@ int AStar::get_closest_point(const Vector3 &p_point) const { for (const Map<int, Point *>::Element *E = points.front(); E; E = E->next()) { + if (!E->get()->enabled) + continue; //Disabled points should not be considered real_t d = p_point.distance_squared_to(E->get()->pos); if (closest_id < 0 || d < closest_dist) { closest_dist = d; @@ -234,6 +236,10 @@ Vector3 AStar::get_closest_position_in_segment(const Vector3 &p_point) const { for (const Set<Segment>::Element *E = segments.front(); E; E = E->next()) { + if (!(E->get().from_point->enabled && E->get().to_point->enabled)) { + continue; + } + Vector3 segment[2] = { E->get().from_point->pos, E->get().to_point->pos, |