godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.14k stars 96 forks source link

Allow controlling 3D editor freelook movement speed with laptop trackpads #10965

Open TranquilMarmot opened 3 days ago

TranquilMarmot commented 3 days ago

Describe the project you are working on

Large open-world 3D third-person shooter

Describe the problem or limitation you are having in your project

Right now when running the editor on a laptop, you can hold down two fingers on the trackpad to "right click" and enable freelook in the 3D editor where you can use WASD to move the camera around. However, you can't really control the speed at which the camera moves around the environment.

When using a mouse, you can use the scroll wheel to change the freelook speed

It looks like there is a spot where magnify_gesture is checked to change the speed, but I don't think it's possible to actually do this while holding down two fingers on the trackpad. At least, I haven't been able to do so on my Macbook Pro.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

It would be nice to be able to bind specific keys to speed up and slow down the freelook camera. I'm not sure what the defaults would be; maybe +/-?

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

When in freelook mode, check if the key bound to speed up / slow down the camera has been pressed. If it has, apply that scale.

If this enhancement will not be used often, can it be worked around with a few lines of script?

It will be used often, especially on laptops or on mice that don't have scroll wheels.

Is there a reason why this should be core and not an add-on in the asset library?

This should be built-in to the editor.

Calinou commented 2 days ago

This can already be done in the Editor Settings (search for "freelook" in the editor settings' Shortcuts tab).

That said, I agree we should assign default keyboard shortcuts[^1] for those actions. However, we need to make sure they're usable while holding down the right mouse button or the trackpad (i.e. no complex combinations). Any ideas?

[^1]: Laptop trackpad gestures are currently only implemented on macOS, so we need an alternative on other platforms.

tetrapod00 commented 1 day ago

This can already be done in the Editor Settings (search for "freelook" in the editor settings' Shortcuts tab).

The Freelook Slow Modifier and Freelook Speed Modifier are bound to keyboard shortcuts (and rebindable). These shortcuts act as a modifier on the base freelook speed. But the base freelook speed itself can only be changed with the scroll wheel or a magnify gesture, and this is hardcoded. Godot_v4 3-stable_win64_AvxOvsbW4H

Laptop trackpad gestures are currently only implemented on macOS

The current magnify_gesture works just fine for me on a windows laptop. I can use that gesture to control the camera zoom level when not in freelook mode. It works in freelook mode too, to change the base camera speed. However, it does not work while also holding the right mouse button to look around, because you can't both pinch and hold the right trackpad button.

Looking at this problem again, this state of things might just be fine - the exact limitation here is that you cannot adjust the base freelook speed, while also moving the freelook camera, while on a laptop. It's enough of an edge case that I'm not sure it's worth adding an extra input just for this case.

TranquilMarmot commented 22 hours ago

You can hold Alt / Shift but the speed change is negligible for larger scenes. I often find myself needing to move the viewport camera very far out and then zoom in on another area and at that point I want to slow down the camera to move around smaller details. When using a mouse, this is easy because you can use the scroll wheel to move faster and then slow down when you get where you want to go.

It doesn't seem too far-fetched to me to add "Freelook Move Speed Increase" and "Freelook Move Speed Decrease" shortcuts that would default to mouse wheel up / mouse wheel down instead of hardcoding it. Not every mouse has a scroll wheel, so this isn't only for trackpads.