summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-07-30 21:16:58 +0200
committerGitHub <noreply@github.com>2021-07-30 21:16:58 +0200
commit5a30ba7a66b32577e5b7d4a19e7fe5fbdad572e9 (patch)
treebdd7bd93b0dc537f82d6ac1936f580981513cfbc
parentfd0775398b5fa5f0300b37e29961493416ec83d2 (diff)
parent0f1e107ede5085aff017e8069697463598c5b512 (diff)
Merge pull request #51080 from timothyqiu/csgbox-nan
Do nothing when dragging CSGBox handle perpendicular to the camera
-rw-r--r--modules/csg/csg_gizmos.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/csg/csg_gizmos.cpp b/modules/csg/csg_gizmos.cpp
index fc84c029ec..42f8b9f163 100644
--- a/modules/csg/csg_gizmos.cpp
+++ b/modules/csg/csg_gizmos.cpp
@@ -135,6 +135,12 @@ void CSGShape3DGizmoPlugin::set_handle(const EditorNode3DGizmo *p_gizmo, int p_i
Vector3 ra, rb;
Geometry3D::get_closest_points_between_segments(Vector3(), axis * 4096, sg[0], sg[1], ra, rb);
float d = ra[p_id];
+
+ if (Math::is_nan(d)) {
+ // The handle is perpendicular to the camera.
+ return;
+ }
+
if (Node3DEditor::get_singleton()->is_snap_enabled()) {
d = Math::snapped(d, Node3DEditor::get_singleton()->get_translate_snap());
}