From f4208ad1e8bdf4eee09780cc5ea84977d615fdd1 Mon Sep 17 00:00:00 2001 From: Haoyu Qiu Date: Sat, 31 Jul 2021 02:25:05 +0800 Subject: [PATCH] Do nothing when dragging CSGBox handle perpendicular to the camera (cherry picked from commit 0f1e107ede5085aff017e8069697463598c5b512) --- modules/csg/csg_gizmos.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/csg/csg_gizmos.cpp b/modules/csg/csg_gizmos.cpp index 4b17b17f60d..f70abb2265d 100644 --- a/modules/csg/csg_gizmos.cpp +++ b/modules/csg/csg_gizmos.cpp @@ -139,6 +139,12 @@ void CSGShapeSpatialGizmoPlugin::set_handle(EditorSpatialGizmo *p_gizmo, int p_i Vector3 ra, rb; Geometry::get_closest_points_between_segments(Vector3(), axis * 4096, sg[0], sg[1], ra, rb); float d = ra[p_idx]; + + if (Math::is_nan(d)) { + // The handle is perpendicular to the camera. + return; + } + if (SpatialEditor::get_singleton()->is_snap_enabled()) { d = Math::stepify(d, SpatialEditor::get_singleton()->get_translate_snap()); }