summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorromulox_x <romulox_x@yahoo.com>2014-12-20 15:28:08 -0800
committerromulox_x <romulox_x@yahoo.com>2014-12-20 15:28:08 -0800
commit8ff61b4d0e1ae6b37c5440389a144cf0f92b0786 (patch)
tree6ac28c69fe0975a669d94662d01a90d36c1f5e9a /scene
parenta36a774897ae191ebb90ba803bac7f919e92bd6c (diff)
fixed bugs in polygon_path_finder for finding nearest points
Diffstat (limited to 'scene')
-rw-r--r--scene/resources/polygon_path_finder.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/scene/resources/polygon_path_finder.cpp b/scene/resources/polygon_path_finder.cpp
index afb0ae1815..9f691d6ad3 100644
--- a/scene/resources/polygon_path_finder.cpp
+++ b/scene/resources/polygon_path_finder.cpp
@@ -142,6 +142,7 @@ Vector<Vector2> PolygonPathFinder::find_path(const Vector2& p_from, const Vector
if (d<closest_dist) {
ignore_from_edge=E->get();
closest_dist=d;
+ closest_point=closest;
}
}
@@ -168,6 +169,7 @@ Vector<Vector2> PolygonPathFinder::find_path(const Vector2& p_from, const Vector
if (d<closest_dist) {
ignore_to_edge=E->get();
closest_dist=d;
+ closest_point=closest;
}
}
@@ -529,7 +531,7 @@ Vector2 PolygonPathFinder::get_closest_point(const Vector2& p_point) const {
float d = p_point.distance_squared_to(points[i].pos);
if (d<closest_dist) {
- d=closest_dist;
+ closest_dist=d;
closest_idx=i;
}