diff options
| author | Hugo Locurcio | 2018-02-04 23:28:04 +0100 |
|---|---|---|
| committer | Hein-Pieter van Braam | 2018-02-19 22:13:45 +0100 |
| commit | fda35b3f42d0d0cc4a1952974e66cb201fa158ef (patch) | |
| tree | d8ea3f1e2f66ef03df394e0383e2c6b26001c14e /editor/spatial_editor_gizmos.cpp | |
| parent | a0e9d751a3cd1aa4cad3a9f830076231505aa1be (diff) | |
| download | godot-fda35b3f42d0d0cc4a1952974e66cb201fa158ef.tar.gz godot-fda35b3f42d0d0cc4a1952974e66cb201fa158ef.tar.zst godot-fda35b3f42d0d0cc4a1952974e66cb201fa158ef.zip | |
Draw the Camera gizmo more accurately
The Camera gizmo no longer looks twice as wide as it actually is.
This fixes #16399.
(cherry picked from commit 0d7d293889edaf12cc3cc4205b5450dee2203cbd)
Diffstat (limited to 'editor/spatial_editor_gizmos.cpp')
| -rw-r--r-- | editor/spatial_editor_gizmos.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/editor/spatial_editor_gizmos.cpp b/editor/spatial_editor_gizmos.cpp index aa7bfab2a..8c90d86b9 100644 --- a/editor/spatial_editor_gizmos.cpp +++ b/editor/spatial_editor_gizmos.cpp @@ -1121,7 +1121,7 @@ void CameraSpatialGizmo::set_handle(int p_idx, Camera *p_camera, const Point2 &p if (camera->get_projection() == Camera::PROJECTION_PERSPECTIVE) { Transform gt = camera->get_global_transform(); float a = _find_closest_angle_to_half_pi_arc(s[0], s[1], 1.0, gt); - camera->set("fov", a); + camera->set("fov", a * 2.0); } else { Vector3 ra, rb; @@ -1178,7 +1178,8 @@ void CameraSpatialGizmo::redraw() { case Camera::PROJECTION_PERSPECTIVE: { - float fov = camera->get_fov(); + // The real FOV is halved for accurate representation + float fov = camera->get_fov() / 2.0; Vector3 side = Vector3(Math::sin(Math::deg2rad(fov)), 0, -Math::cos(Math::deg2rad(fov))); Vector3 nside = side; |
