Merge pull request #39592 from vorblen/master

Fix "Fully Axis-Locked" Freelook Navigation Scheme
This commit is contained in:
Rémi Verschelde 2020-06-21 21:47:01 +02:00 committed by GitHub
commit 091e500a88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 12 deletions

View File

@ -2106,12 +2106,7 @@ void Node3DEditorViewport::_nav_orbit(Ref<InputEventWithModifiers> p_event, cons
cursor.x_rot += p_relative.y * radians_per_pixel;
}
cursor.y_rot += p_relative.x * radians_per_pixel;
if (cursor.x_rot > Math_PI / 2.0) {
cursor.x_rot = Math_PI / 2.0;
}
if (cursor.x_rot < -Math_PI / 2.0) {
cursor.x_rot = -Math_PI / 2.0;
}
cursor.x_rot = CLAMP(cursor.x_rot, -1.57, 1.57);
name = "";
_update_name();
}
@ -2139,12 +2134,7 @@ void Node3DEditorViewport::_nav_look(Ref<InputEventWithModifiers> p_event, const
cursor.x_rot += p_relative.y * radians_per_pixel;
}
cursor.y_rot += p_relative.x * radians_per_pixel;
if (cursor.x_rot > Math_PI / 2.0) {
cursor.x_rot = Math_PI / 2.0;
}
if (cursor.x_rot < -Math_PI / 2.0) {
cursor.x_rot = -Math_PI / 2.0;
}
cursor.x_rot = CLAMP(cursor.x_rot, -1.57, 1.57);
// Look is like the opposite of Orbit: the focus point rotates around the camera
Transform camera_transform = to_camera_transform(cursor);