1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-29 16:16:38 +00:00

Clamps fov/size for Camera gizmo

This commit is contained in:
Haoyu Qiu
2019-12-29 11:36:57 +08:00
parent 318c693516
commit cbb8930813
2 changed files with 4 additions and 3 deletions

View File

@@ -1275,7 +1275,7 @@ void CameraSpatialGizmoPlugin::set_handle(EditorSpatialGizmo *p_gizmo, int p_idx
if (camera->get_projection() == Camera::PROJECTION_PERSPECTIVE) {
Transform gt2 = camera->get_global_transform();
float a = _find_closest_angle_to_half_pi_arc(s[0], s[1], 1.0, gt2);
camera->set("fov", a * 2.0);
camera->set("fov", CLAMP(a * 2.0, 1, 179));
} else {
Vector3 ra, rb;
@@ -1285,8 +1285,7 @@ void CameraSpatialGizmoPlugin::set_handle(EditorSpatialGizmo *p_gizmo, int p_idx
d = Math::stepify(d, SpatialEditor::get_singleton()->get_translate_snap());
}
if (d < 0)
d = 0;
d = CLAMP(d, 0.1, 16384);
camera->set("size", d);
}