Merge pull request #16402 from Calinou/fix-camera-gizmo

Draw the Camera gizmo more accurately
This commit is contained in:
Rémi Verschelde 2018-02-13 13:10:33 +01:00 committed by GitHub
commit 448076edb6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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;