mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-01-12 13:51:10 +01:00
Fix get_simple_path
behavior in 2D, fixes #56852
This commit is contained in:
parent
e77e34db8e
commit
0909a9adb5
@ -378,19 +378,16 @@ Vector<Vector3> NavMap::get_path(Vector3 p_origin, Vector3 p_destination, bool p
|
|||||||
|
|
||||||
// Add mid points
|
// Add mid points
|
||||||
int np_id = least_cost_id;
|
int np_id = least_cost_id;
|
||||||
while (np_id != -1) {
|
while (np_id != -1 && navigation_polys[np_id].prev_navigation_poly_id != -1) {
|
||||||
#ifdef USE_ENTRY_POINT
|
|
||||||
Vector3 point = navigation_polys[np_id].entry;
|
|
||||||
#else
|
|
||||||
int prev = navigation_polys[np_id].back_navigation_edge;
|
int prev = navigation_polys[np_id].back_navigation_edge;
|
||||||
int prev_n = (navigation_polys[np_id].back_navigation_edge + 1) % navigation_polys[np_id].poly->points.size();
|
int prev_n = (navigation_polys[np_id].back_navigation_edge + 1) % navigation_polys[np_id].poly->points.size();
|
||||||
Vector3 point = (navigation_polys[np_id].poly->points[prev].pos + navigation_polys[np_id].poly->points[prev_n].pos) * 0.5;
|
Vector3 point = (navigation_polys[np_id].poly->points[prev].pos + navigation_polys[np_id].poly->points[prev_n].pos) * 0.5;
|
||||||
#endif
|
|
||||||
|
|
||||||
path.push_back(point);
|
path.push_back(point);
|
||||||
np_id = navigation_polys[np_id].prev_navigation_poly_id;
|
np_id = navigation_polys[np_id].prev_navigation_poly_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
path.push_back(begin_point);
|
||||||
|
|
||||||
path.invert();
|
path.invert();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user