From d6e7308b3fcfb4f8bf116796e28f5fce7f33a8f6 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Sun, 2 Jan 2022 21:53:27 +0100 Subject: [PATCH] Split 3D editor sensitivity freelook sensitivity into its own setting This allows configuring orbit sensitivity and freelook sensitivity independently from each other. Often, it's needed to use a lower freelook sensitivity compared to the orbit sensitivity. Also, 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. --- editor/editor_settings.cpp | 2 ++ editor/plugins/spatial_editor_plugin.cpp | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index e22a1585c6cb..52a310f71dae 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -574,6 +574,8 @@ void EditorSettings::_load_defaults(Ref p_extra_config) { // 3D: Freelook _initial_set("editors/3d/freelook/freelook_navigation_scheme", false); hints["editors/3d/freelook/freelook_navigation_scheme"] = PropertyInfo(Variant::INT, "editors/3d/freelook/freelook_navigation_scheme", PROPERTY_HINT_ENUM, "Default,Partially Axis-Locked (id Tech),Fully Axis-Locked (Minecraft)"); + _initial_set("editors/3d/freelook/freelook_sensitivity", 0.25); + hints["editors/3d/freelook/freelook_sensitivity"] = PropertyInfo(Variant::REAL, "editors/3d/freelook/freelook_sensitivity", PROPERTY_HINT_RANGE, "0.01, 2, 0.001"); _initial_set("editors/3d/freelook/freelook_inertia", 0.0); hints["editors/3d/freelook/freelook_inertia"] = PropertyInfo(Variant::REAL, "editors/3d/freelook/freelook_inertia", PROPERTY_HINT_RANGE, "0, 1, 0.001"); _initial_set("editors/3d/freelook/freelook_base_speed", 5.0); diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp index 7723f6b7e9e5..ba3fc6eb0c02 100644 --- a/editor/plugins/spatial_editor_plugin.cpp +++ b/editor/plugins/spatial_editor_plugin.cpp @@ -2253,7 +2253,8 @@ void SpatialEditorViewport::_nav_look(Ref p_event, cons _menu_option(VIEW_PERSPECTIVE); } - const real_t degrees_per_pixel = EditorSettings::get_singleton()->get("editors/3d/navigation_feel/orbit_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");