godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
88.97k stars 20.18k forks source link

MacBook trackpad panning and orbit are slow in 3D viewport #75855

Open CaptainKraft opened 1 year ago

CaptainKraft commented 1 year ago

Godot version

4.0.2.stable

System information

M1 MacBook Pro 2021, Ventura 13.3.1

Issue description

Panning and orbiting in the 3D viewport with the trackpad on my MacBook Pro are very slow. Increasing "Orbit Sensitivity" in the editor settings to 2.0 (the maximum) helps a bit, but then when I go back to using a mouse, the sensitivity is extremely high.

I checked issue #72242, which was resolved, but it seems like those changes only affected the 2D viewport behavior.

Here is a video of the behavior I'm seeing:

https://user-images.githubusercontent.com/1237356/230779551-95d6f0e7-ad43-42cb-b3a1-7aa6d98e819d.mov

Steps to reproduce

  1. Open the 3D view of any project
  2. Using two-finger scrolling on a MacBook Pro trackpad, orbit around the viewport
  3. Alternatively, hold the panning modifier when moving to test panning

Minimal reproduction project

This can be reproduced with a new empty project.

geminax commented 1 year ago

As a temporary workaround for the slow orbiting, you might benefit from increasing your trackpad scroll speed in system settings. As for panning, there is no sensitivity option, so it might be worth to add a "Translation sensitivity" slider, something like: (Can also increase the orbit sensitivity maximum for cases like these)

diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index 8634b94858..e0cce43da1 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -662,7 +662,8 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
        _initial_set("editors/3d/navigation/warped_mouse_panning", true);

        // 3D: Navigation feel
-       EDITOR_SETTING(Variant::FLOAT, PROPERTY_HINT_RANGE, "editors/3d/navigation_feel/orbit_sensitivity", 0.25, "0.01,2,0.001")
+       EDITOR_SETTING(Variant::FLOAT, PROPERTY_HINT_RANGE, "editors/3d/navigation_feel/orbit_sensitivity", 0.25, "0.01,100,0.001")
+       EDITOR_SETTING(Variant::FLOAT, PROPERTY_HINT_RANGE, "editors/3d/navigation_feel/translation_sensitivity", 0.25, "0.01,100,0.001")
        EDITOR_SETTING(Variant::FLOAT, PROPERTY_HINT_RANGE, "editors/3d/navigation_feel/orbit_inertia", 0.0, "0,1,0.001")
        EDITOR_SETTING(Variant::FLOAT, PROPERTY_HINT_RANGE, "editors/3d/navigation_feel/translation_inertia", 0.05, "0,1,0.001")
        EDITOR_SETTING(Variant::FLOAT, PROPERTY_HINT_RANGE, "editors/3d/navigation_feel/zoom_inertia", 0.05, "0,1,0.001")
diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp
index 4b65ce7304..073c85b6c9 100644
--- a/editor/plugins/node_3d_editor_plugin.cpp
+++ b/editor/plugins/node_3d_editor_plugin.cpp
@@ -2325,8 +2325,9 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {

 void Node3DEditorViewport::_nav_pan(Ref<InputEventWithModifiers> p_event, const Vector2 &p_relative) {
        const NavigationScheme nav_scheme = (NavigationScheme)EDITOR_GET("editors/3d/navigation/navigation_scheme").operator int();
+       const real_t translation_sensitivity = EDITOR_GET("editors/3d/navigation_feel/translation_sensitivity");

-       real_t pan_speed = 1 / 150.0;
+       real_t pan_speed = 4 / 150.0 * translation_sensitivity;
        if (p_event.is_valid() && nav_scheme == NAVIGATION_MAYA && p_event->is_shift_pressed()) {
                pan_speed *= 10;
        }
CreepGin commented 1 year ago

@geminax Thanks! Your translation_sensitivity addition was the missing piece I needed to align my Godot experience with years of Unity/Maya muscle memory. Hopefully it helps with OP's original issue as well.

Should we get this PR started (if you haven't already)?

Update: Hope you won't mind, I just prepared a PR based on your code. #81714