Skip to content

Commit b40e6a5

Browse files
committed
Merge pull request #101884 from aaronp64/camera_gizmo_fov_fix
Fix `Camera3D` gizmo representation to accurately reflect FOV
2 parents 7d46e7d + 7e4d635 commit b40e6a5

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

editor/plugins/gizmos/camera_3d_gizmo_plugin.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,13 @@ void Camera3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
180180

181181
const float hsize = Math::sin(Math::deg_to_rad(fov));
182182
const float depth = -Math::cos(Math::deg_to_rad(fov));
183-
Vector3 side = Vector3(hsize * size_factor.x, 0, depth);
183+
184+
Vector3 side;
185+
if (camera->get_keep_aspect_mode() == Camera3D::KEEP_WIDTH) {
186+
side = Vector3(hsize * size_factor.x, 0, depth * size_factor.x);
187+
} else {
188+
side = Vector3(hsize * size_factor.x, 0, depth * size_factor.y);
189+
}
184190
Vector3 nside = Vector3(-side.x, side.y, side.z);
185191
Vector3 up = Vector3(0, hsize * size_factor.y, 0);
186192

0 commit comments

Comments
 (0)