Skip to content

[Editor][3D] Fix panning, orbiting, and freelook - #123109

Open
adamscott wants to merge 1 commit into
godotengine:masterfrom
adamscott:revamp-3d-editor-view-3d-controller
Open

[Editor][3D] Fix panning, orbiting, and freelook#123109
adamscott wants to merge 1 commit into
godotengine:masterfrom
adamscott:revamp-3d-editor-view-3d-controller

Conversation

@adamscott

@adamscott adamscott commented Sep 2, 2026

Copy link
Copy Markdown
Member

What problem(s) does this PR solve?

Additional information

This PR fixes the pan, orbit, and freelook features of the 3D editor by relying on real distances travelled by the mouse. By projecting the relative motion in 3D (based on the camera distance from the cursor (i.e. the target of the camera)), we can get the real distance travelled by the mouse without the need of an approximation of speed/radians per pixel.

Warning

It removes 3 editor parameters and adds 3 back. It is due to the fact that the "sensitivity" properties were in fact m/pixel for the pan and °/pixel for orbit and freelook. Also, the default values of these parameters were not 1. The new factor properties are simple multipliers and are all defaulting to 1.

Removes:

  • editors/3d/navigation_feel/orbit_sensitivity
  • editors/3d/navigation_feel/translation_sensitivity
  • editors/3d/freelook/freelook_sensitivity

Adds:

  • editors/3d/navigation_feel/orbit_factor
  • editors/3d/navigation_feel/translation_factor
  • editors/3d/freelook/freelook_factor

Edit: I added an automatic conversion based on the ratio of the current value and the default value.

My solution even has the bonus to be natively 100% compatible with funky FOV values without any need of any hacks (as it was needed previously), as shown below.

funky_fovs.webm

(If you don't recognize the view settings popup, don't worry. This is my WIP to update the popup, it is NOT included in this PR.)

How does it work?

Pan

For the pan, the negative of the difference between the final position of the mouse and the start position is applied to the position of the cursor.

Orbit

For the orbit, this PR use the linear distance travelled by the mouse as the length of an arc. That arc length is then used to find the actual equivalent radians for an arc in a circle that has a radius of the camera distance from the cursor.

BC5E49BE-B8A6-44F5-9F35-8E5B2802F1A1_1_201_a

On the left, the movement made by the user on the screen translates to two 3D positions. By calculating the length of it, we can calculate the angle of rotation.

Freelook

For the freelook, it's essentially the same calculation of the orbit.

Preview

Pan

Display scale @ 100% (small window) Display scale @ 100% (large window) Display scale @ 200% (small window)
pr_100_pan_small.webm
pr_100_pan_large.webm
pr_200_pan.webm

Orbit

Display scale @ 100% (small window) Display scale @ 100% (large window) Display scale @ 200% (small window)
pr_100_orbit_small.webm
pr_100_orbit_large.webm
pr_200_orbit.webm

Freelook

Display scale @ 100% (small window) Display scale @ 100% (large window) Display scale @ 200% (small window)
pr_100_freelook_small.webm
pr_100_freelook_large.webm
pr_200_freelook.webm

Todo

  • Write documentation for new editor properties.

@adamscott adamscott added this to the 4.x milestone Sep 2, 2026
@adamscott
adamscott requested review from a team as code owners September 2, 2026 14:19
@adamscott
adamscott force-pushed the revamp-3d-editor-view-3d-controller branch from e42fc33 to f5d106e Compare September 2, 2026 15:26
@adamscott
adamscott requested a review from a team as a code owner September 2, 2026 15:26
@adamscott
adamscott force-pushed the revamp-3d-editor-view-3d-controller branch from f5d106e to 52e9987 Compare September 2, 2026 16:20
@adamscott

Copy link
Copy Markdown
Member Author

Removed the "breaks compat" tag due to the added automatic conversion.

@adamscott
adamscott force-pushed the revamp-3d-editor-view-3d-controller branch from 52e9987 to a3d19bd Compare September 2, 2026 16:24
Comment thread doc/classes/EditorSettings.xml Outdated
Comment thread doc/classes/EditorSettings.xml Outdated
Comment thread doc/classes/EditorSettings.xml Outdated
@dt10812

dt10812 commented Sep 3, 2026

Copy link
Copy Markdown

@adamscott
Also, this is optional, but can you please make the drawings better using text and lines for them to be faster and easier to understand?
This drawing to be precise

Comment thread editor/scene/3d/node_3d_editor_viewport.cpp Outdated
Comment thread editor/settings/editor_settings.cpp
@adamscott
adamscott force-pushed the revamp-3d-editor-view-3d-controller branch 3 times, most recently from 074eded to bbdc0a9 Compare September 3, 2026 18:58
@adamscott

Copy link
Copy Markdown
Member Author

As suggested by @Mickeon, instead of using editors/3d/navigation_feel/translation_factor, I used editors/3d/navigation_feel/pan_factor.

And as it was just a few number of lines, I also renamed editors/3d/navigation_feel/translation_inertia to editors/3d/navigation_feel/pan_inertia. It also triggers an automatic rename.

Also:
- Rename `editor/3d/navigation_feel/translation_inertia` to `editor/3d/navigation_feel/pan_inertia`
@adamscott
adamscott force-pushed the revamp-3d-editor-view-3d-controller branch from bbdc0a9 to 7ef25ec Compare September 3, 2026 19:02
Comment thread doc/classes/EditorSettings.xml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Editor][3D] Viewport navigation is flawed and imprecise

5 participants