diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-11-09 14:15:48 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-09 14:15:48 +0100 |
commit | eb98fd94421b124a5848d7ee6c7ead4337222c6c (patch) | |
tree | 3c3974c89b74244a707f85f4c1462a7f4e3dc57e /editor/plugins | |
parent | 26f82563de556e6df43b3c9e49523d67420251af (diff) | |
parent | 3bd7c4f2a93e2dfa495ffe68291a26b7112081e2 (diff) |
Merge pull request #54788 from rcorre/orbit_clamp
Diffstat (limited to 'editor/plugins')
-rw-r--r-- | editor/plugins/node_3d_editor_plugin.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index fa5381bb10..e4bc9ef690 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -2245,12 +2245,14 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) { _menu_option(VIEW_RIGHT); } if (ED_IS_SHORTCUT("spatial_editor/orbit_view_down", p_event)) { - cursor.x_rot -= Math_PI / 12.0; + // Clamp rotation to roughly -90..90 degrees so the user can't look upside-down and end up disoriented. + cursor.x_rot = CLAMP(cursor.x_rot - Math_PI / 12.0, -1.57, 1.57); view_type = VIEW_TYPE_USER; _update_name(); } if (ED_IS_SHORTCUT("spatial_editor/orbit_view_up", p_event)) { - cursor.x_rot += Math_PI / 12.0; + // Clamp rotation to roughly -90..90 degrees so the user can't look upside-down and end up disoriented. + cursor.x_rot = CLAMP(cursor.x_rot + Math_PI / 12.0, -1.57, 1.57); view_type = VIEW_TYPE_USER; _update_name(); } |