summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-06-22 11:38:09 +0200
committerGitHub <noreply@github.com>2020-06-22 11:38:09 +0200
commit417d15a23ae6d4a4227eea40a72472d9c932f26f (patch)
treeca5cad3c2504c7be1a4c07677393eb3f926d8586
parentbd85e4ec16f2a3d2822bb87b8cc67600f74e9d98 (diff)
parented2bbdbbefa190a707f4e09d9bd9c04b564f32ae (diff)
Merge pull request #39749 from aaronfranke/nan-editor-camera
Avoid errors when the editor camera is inside the focused object
-rw-r--r--editor/plugins/node_3d_editor_plugin.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp
index d2f94a6d28..961ae10f46 100644
--- a/editor/plugins/node_3d_editor_plugin.cpp
+++ b/editor/plugins/node_3d_editor_plugin.cpp
@@ -3208,7 +3208,7 @@ void Node3DEditorViewport::update_transform_gizmo_view() {
Vector3 camz = -camera_xform.get_basis().get_axis(2).normalized();
Vector3 camy = -camera_xform.get_basis().get_axis(1).normalized();
Plane p(camera_xform.origin, camz);
- float gizmo_d = Math::abs(p.distance_to(xform.origin));
+ float gizmo_d = MAX(Math::abs(p.distance_to(xform.origin)), CMP_EPSILON);
float d0 = camera->unproject_position(camera_xform.origin + camz * gizmo_d).y;
float d1 = camera->unproject_position(camera_xform.origin + camz * gizmo_d + camy).y;
float dd = Math::abs(d0 - d1);