summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Locurcio <hugo.locurcio@hugo.pro>2022-01-02 20:07:19 +0100
committerHugo Locurcio <hugo.locurcio@hugo.pro>2022-01-02 20:07:19 +0100
commitfb4261b82f518c76e197aba76f06f2d83d314a69 (patch)
tree22a911a85f30bc6490c5720a9d39b4a2c383f886
parent223beef14a6c6a3c904a3810c2fba353994937c2 (diff)
Scale freelook sensitivity with zoom in the 3D editor
When using a FOV scale lower than the default (using Alt + mouse wheel), the mouse sensitivity is now scaled to make it easier to use freelook to look at distant objects. This does not affect orbiting and panning.
-rw-r--r--editor/plugins/node_3d_editor_plugin.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp
index f49b749046..c2f8d144ee 100644
--- a/editor/plugins/node_3d_editor_plugin.cpp
+++ b/editor/plugins/node_3d_editor_plugin.cpp
@@ -2439,7 +2439,8 @@ void Node3DEditorViewport::_nav_look(Ref<InputEventWithModifiers> p_event, const
_menu_option(VIEW_PERSPECTIVE);
}
- const real_t degrees_per_pixel = EditorSettings::get_singleton()->get("editors/3d/freelook/freelook_sensitivity");
+ // Scale mouse sensitivity with camera FOV scale when zoomed in to make it easier to point at things.
+ const real_t degrees_per_pixel = real_t(EditorSettings::get_singleton()->get("editors/3d/freelook/freelook_sensitivity")) * MIN(1.0, cursor.fov_scale);
const real_t radians_per_pixel = Math::deg2rad(degrees_per_pixel);
const bool invert_y_axis = EditorSettings::get_singleton()->get("editors/3d/navigation/invert_y_axis");