Skip to content

Commit 7e4d635

Browse files
committed
Fix Camera3D gizmo representation to accurately reflect FOV
Updated gizmo drawing to keep depth proportional to width or height based on whether FOV is horizontal or vertical.
1 parent f2cc3f1 commit 7e4d635

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)