Fix NavigationServer3D.get_closest_point_to_segment() with use_collision

This commit is contained in:
Per Melin
2024-06-06 23:20:05 +02:00
parent e96ad5af98
commit 9b191f669c
2 changed files with 6 additions and 2 deletions

View File

@@ -617,7 +617,7 @@ Vector3 NavMap::get_closest_point_to_segment(const Vector3 &p_from, const Vector
const Face3 f(p.points[0].pos, p.points[point_id - 1].pos, p.points[point_id].pos);
Vector3 inters;
if (f.intersects_segment(p_from, p_to, &inters)) {
const real_t d = closest_point_d = p_from.distance_to(inters);
const real_t d = p_from.distance_to(inters);
if (use_collision == false) {
closest_point = inters;
use_collision = true;