From 371b5513d3741104a2b819ddcef9cc743435b4a6 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Fri, 8 Apr 2022 18:53:07 +0200 Subject: [PATCH] Allow `size` values as low as `0.001` in Camera's orthogonal/frustum mode This allows for lower field of view (or higher zoom) in orthogonal and frustum camera modes. The property hint also allows setting the size with greater precision. --- doc/classes/Camera.xml | 2 +- scene/3d/camera.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/classes/Camera.xml b/doc/classes/Camera.xml index 2263ee890..4f8aafe92 100644 --- a/doc/classes/Camera.xml +++ b/doc/classes/Camera.xml @@ -177,7 +177,7 @@ The camera's projection mode. In [constant PROJECTION_PERSPECTIVE] mode, objects' Z distance from the camera's local space scales their perceived size. - The camera's size measured as 1/2 the width or height. Only applicable in orthogonal mode. Since [member keep_aspect] locks on axis, [code]size[/code] sets the other axis' size length. + The camera's size measured as 1/2 the width or height. Only applicable in orthogonal and frustum modes. Since [member keep_aspect] locks on axis, [code]size[/code] sets the other axis' size length. The vertical (Y) offset of the camera viewport. diff --git a/scene/3d/camera.cpp b/scene/3d/camera.cpp index f2fd4515d..a86614ea5 100644 --- a/scene/3d/camera.cpp +++ b/scene/3d/camera.cpp @@ -530,7 +530,7 @@ void Camera::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "projection", PROPERTY_HINT_ENUM, "Perspective,Orthogonal,Frustum"), "set_projection", "get_projection"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "current"), "set_current", "is_current"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "fov", PROPERTY_HINT_RANGE, "1,179,0.1"), "set_fov", "get_fov"); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "size", PROPERTY_HINT_RANGE, "0.1,16384,0.01"), "set_size", "get_size"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "size", PROPERTY_HINT_RANGE, "0.001,16384,0.001"), "set_size", "get_size"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "frustum_offset"), "set_frustum_offset", "get_frustum_offset"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "near", PROPERTY_HINT_EXP_RANGE, "0.01,8192,0.01,or_greater"), "set_znear", "get_znear"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "far", PROPERTY_HINT_EXP_RANGE, "0.1,8192,0.1,or_greater"), "set_zfar", "get_zfar"); @@ -579,7 +579,7 @@ void Camera::set_fov(float p_fov) { } void Camera::set_size(float p_size) { - ERR_FAIL_COND(p_size < 0.1 || p_size > 16384); + ERR_FAIL_COND(p_size < 0.001 || p_size > 16384); size = p_size; _update_camera_mode(); _change_notify("size");