summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorAaron Franke <arnfranke@yahoo.com>2020-06-22 04:53:22 -0400
committerAaron Franke <arnfranke@yahoo.com>2020-06-22 04:53:29 -0400
commited2bbdbbefa190a707f4e09d9bd9c04b564f32ae (patch)
treefda3a1ff9c4713ac7056b42aece85562259f0add /editor
parent10d2fa4210f9287af413d38c9ce8baf0b343ba20 (diff)
Avoid errors when the editor camera is inside the focused object
Prevent the gizmo distance from being zero by MAX-ing it with CMP_EPSILON
Diffstat (limited to 'editor')
-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);