소스 검색

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
Aaron Franke 5 년 전
부모
커밋
ed2bbdbbef
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      editor/plugins/node_3d_editor_plugin.cpp

+ 1 - 1
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);