@@ -138,7 +138,7 @@ int NavigationObstacle3DGizmoPlugin::subgizmos_intersect_ray(const EditorNode3DG
138138
139139 for (int idx = 0 ; idx < vertices.size (); ++idx) {
140140 Vector3 pos = gt.xform (vertices[idx]);
141- if (p_camera->unproject_position (pos).distance_to (p_point) < 20 ) {
141+ if (p_camera->unproject_position (pos).distance_to (p_point) < 20 . 0f ) {
142142 return idx;
143143 }
144144 }
@@ -456,7 +456,7 @@ EditorPlugin::AfterGUIInput NavigationObstacle3DEditorPlugin::forward_3d_gui_inp
456456 Vector3 cpoint = Vector3 (spoint.x , 0.0 , spoint.z );
457457 Vector<Vector3> obstacle_vertices = obstacle_node->get_vertices ();
458458
459- real_t grab_threshold = EDITOR_GET (" editors/polygon_editor/point_grab_radius" );
459+ const real_t grab_threshold = EDITOR_GET (" editors/polygon_editor/point_grab_radius" );
460460
461461 switch (mode) {
462462 case MODE_CREATE: {
@@ -474,9 +474,9 @@ EditorPlugin::AfterGUIInput NavigationObstacle3DEditorPlugin::forward_3d_gui_inp
474474 continue ; // Skip edge as clicked point is too close to existing vertex.
475475 }
476476
477- real_t d = cp.distance_to (mouse_position);
478- if (d < closest_dist && d < grab_threshold) {
479- closest_dist = d ;
477+ const real_t dist = cp.distance_to (mouse_position);
478+ if (dist < closest_dist && dist < grab_threshold) {
479+ closest_dist = dist ;
480480 closest_edge_point = cp;
481481 closest_idx = i;
482482 }
@@ -542,9 +542,9 @@ EditorPlugin::AfterGUIInput NavigationObstacle3DEditorPlugin::forward_3d_gui_inp
542542 }
543543
544544 // search edges
545- int closest_idx = -1 ;
546545 Vector2 closest_pos;
547546 real_t closest_dist = 1e10 ;
547+ int closest_idx = -1 ;
548548 for (int i = 0 ; i < obstacle_vertices.size (); i++) {
549549 const Vector2 a = p_camera->unproject_position (gt.xform (obstacle_vertices[i]));
550550 const Vector2 b = p_camera->unproject_position (gt.xform (obstacle_vertices[(i + 1 ) % obstacle_vertices.size ()]));
@@ -554,9 +554,9 @@ EditorPlugin::AfterGUIInput NavigationObstacle3DEditorPlugin::forward_3d_gui_inp
554554 continue ; // not valid to reuse point
555555 }
556556
557- real_t d = cp.distance_to (mouse_position);
558- if (d < closest_dist && d < grab_threshold) {
559- closest_dist = d ;
557+ const real_t dist = cp.distance_to (mouse_position);
558+ if (dist < closest_dist && dist < grab_threshold) {
559+ closest_dist = dist ;
560560 closest_pos = cp;
561561 closest_idx = i;
562562 }
@@ -574,15 +574,15 @@ EditorPlugin::AfterGUIInput NavigationObstacle3DEditorPlugin::forward_3d_gui_inp
574574 return EditorPlugin::AFTER_GUI_INPUT_STOP;
575575 }
576576 } else {
577- int closest_idx = -1 ;
578577 Vector2 closest_pos;
579578 real_t closest_dist = 1e10 ;
579+ int closest_idx = -1 ;
580580 for (int i = 0 ; i < obstacle_vertices.size (); i++) {
581581 Vector2 cp = p_camera->unproject_position (gt.xform (obstacle_vertices[i]));
582582
583- real_t d = cp.distance_to (mouse_position);
584- if (d < closest_dist && d < grab_threshold) {
585- closest_dist = d ;
583+ const real_t dist = cp.distance_to (mouse_position);
584+ if (dist < closest_dist && dist < grab_threshold) {
585+ closest_dist = dist ;
586586 closest_pos = cp;
587587 closest_idx = i;
588588 }
@@ -620,13 +620,13 @@ EditorPlugin::AfterGUIInput NavigationObstacle3DEditorPlugin::forward_3d_gui_inp
620620
621621 case MODE_DELETE: {
622622 if (mb->get_button_index () == MouseButton::LEFT && mb->is_pressed ()) {
623- int closest_idx = -1 ;
624623 real_t closest_dist = 1e10 ;
624+ int closest_idx = -1 ;
625625 for (int i = 0 ; i < obstacle_vertices.size (); i++) {
626626 Vector2 point = p_camera->unproject_position (gt.xform (obstacle_vertices[i]));
627- real_t d = point.distance_to (mouse_position);
628- if (d < closest_dist && d < grab_threshold) {
629- closest_dist = d ;
627+ const real_t dist = point.distance_to (mouse_position);
628+ if (dist < closest_dist && dist < grab_threshold) {
629+ closest_dist = dist ;
630630 closest_idx = i;
631631 }
632632 }
0 commit comments