diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-06-21 21:47:01 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-21 21:47:01 +0200 |
commit | 091e500a887b68c1734d17dd40c5ea47a83b73cc (patch) | |
tree | 9b786f9d8fc2d75f4786a305478239ccefdd1d03 /editor | |
parent | 9ecb85644bba4207efcfe5e595ccb872efe7533a (diff) | |
parent | 29e901c3420fc823fddebd3f8b885e8a816debe3 (diff) |
Merge pull request #39592 from vorblen/master
Fix "Fully Axis-Locked" Freelook Navigation Scheme
Diffstat (limited to 'editor')
-rw-r--r-- | editor/plugins/node_3d_editor_plugin.cpp | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index 896471dab5..d2f94a6d28 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -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); |