diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2018-03-23 11:28:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-23 11:28:05 +0100 |
commit | 699325f9a13f51ca2a592d14c4926942ca9ed901 (patch) | |
tree | c0c7c2d8a25e6b3c9e302b23e70d8c0176a7460e /editor/plugins/spatial_editor_plugin.cpp | |
parent | f720d86b0bef3967d1bd65771bf2286c63914808 (diff) | |
parent | 57e6b8781ca311ffd919f25a2c36039f45866c2a (diff) |
Merge pull request #17505 from ArkDShiggy/invert_y-axis
add option to invert y-axis
Diffstat (limited to 'editor/plugins/spatial_editor_plugin.cpp')
-rw-r--r-- | editor/plugins/spatial_editor_plugin.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp index 9e7bfd5787..e484140527 100644 --- a/editor/plugins/spatial_editor_plugin.cpp +++ b/editor/plugins/spatial_editor_plugin.cpp @@ -1907,8 +1907,13 @@ void SpatialEditorViewport::_nav_orbit(Ref<InputEventWithModifiers> p_event, con real_t degrees_per_pixel = EditorSettings::get_singleton()->get("editors/3d/navigation_feel/orbit_sensitivity"); real_t radians_per_pixel = Math::deg2rad(degrees_per_pixel); + bool invert_y_axis = EditorSettings::get_singleton()->get("editors/3d/navigation/invert_y-axis"); - cursor.x_rot += p_relative.y * radians_per_pixel; + if (invert_y_axis) { + cursor.x_rot -= p_relative.y * radians_per_pixel; + } else { + 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; @@ -1925,11 +1930,16 @@ void SpatialEditorViewport::_nav_look(Ref<InputEventWithModifiers> p_event, cons if (!orthogonal) { real_t degrees_per_pixel = EditorSettings::get_singleton()->get("editors/3d/navigation_feel/orbit_sensitivity"); real_t radians_per_pixel = Math::deg2rad(degrees_per_pixel); + bool invert_y_axis = EditorSettings::get_singleton()->get("editors/3d/navigation/invert_y-axis"); // Note: do NOT assume the camera has the "current" transform, because it is interpolated and may have "lag". Transform prev_camera_transform = to_camera_transform(cursor); - cursor.x_rot += p_relative.y * radians_per_pixel; + if (invert_y_axis) { + cursor.x_rot -= p_relative.y * radians_per_pixel; + } else { + 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; |