You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-25 15:37:42 +00:00
Merge pull request #30112 from AgentEnder/master
AStar get_current_point enabled consideration
This commit is contained in:
@@ -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()) {
|
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);
|
real_t d = p_point.distance_squared_to(E->get()->pos);
|
||||||
if (closest_id < 0 || d < closest_dist) {
|
if (closest_id < 0 || d < closest_dist) {
|
||||||
closest_dist = d;
|
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()) {
|
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] = {
|
Vector3 segment[2] = {
|
||||||
E->get().from_point->pos,
|
E->get().from_point->pos,
|
||||||
E->get().to_point->pos,
|
E->get().to_point->pos,
|
||||||
|
|||||||
Reference in New Issue
Block a user