Merge pull request #51080 from timothyqiu/csgbox-nan

Do nothing when dragging CSGBox handle perpendicular to the camera
This commit is contained in:
Rémi Verschelde 2021-07-30 21:16:58 +02:00 committed by GitHub
commit 5a30ba7a66
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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());
}