Skip to content

Common 3D Navigation and Settings for the Editor Viewport#10439

Open
FabiPhun wants to merge 13 commits intoFacepunch:masterfrom
FabiPhun:ImprovedViewportControls
Open

Common 3D Navigation and Settings for the Editor Viewport#10439
FabiPhun wants to merge 13 commits intoFacepunch:masterfrom
FabiPhun:ImprovedViewportControls

Conversation

@FabiPhun
Copy link
Copy Markdown

@FabiPhun FabiPhun commented Apr 10, 2026

Pull Request

Thanks for contributing to s&box ❤️
Please fill out the sections below to help us review your change efficiently.


Summary

Rewrote the 3D Viewport Navigation within the S&box editor, to be closely resembling common 3D Software while keeping the "WASD" and camera "look around" functionality (flying camera in short) fully functional.

Motivation & Context

I have posted a feature request on the S&box GitHub discussing the poor navigation.

Having talked to other members on the S&box Discord, people seemed quite enthused with the idea of a navigation experience resembling most common 3D Software, I therefore created a JS prototype within a week as a proof of concept.

Fixes:

  • Merged the Pan-logic, from FirstPersonCamera with OrbitCamera
  • Rewrote Orbit / Pan / Zoom logic to use distance aware navigation
  • Removed unused / illogical settings within the Scene View settings
  • Added new settings to support the new Orbit / Pan / Zoom

Implementation Details

Files edited:

  • SceneViewportWidget.cs
  • SceneViewportExtensions.cs
  • EditorPreferences.cs
  • PageSceneView.cs

  • Works in both Perspective and Orthographic Views

  • Point Specific Navigation
    A ray is shot from mousePos/Screenspace, when it hits something it uses the distance and position to change the zoom speed, the point around which the camera orbits and it gives the pan the necessary data to stick the point where the user clicked to the mouse cursor ( includes FOV calculations' ).

  • SceneViewportWidget.cs
    I had quite the fight with some of the specific exception logic and errors while adapting the new Inputs - I did some hacks here and there and would recommend the FP to find a new approach to using exceptions and Inputs within the viewport.

  • Navigation Styles
    I added the option for Software specific Navigation Styles instead of just one set style, the reasoning here is so anyone can use their favorite Style of Navigation.

Screenshots / Videos (if applicable)

Showcase Video:
https://github.com/user-attachments/assets/fe579fe6-38bc-4a66-978f-1213164f0b44

Settings Screenshot:
Screenshot_4

Pull Request

##Checklist

  • Code follows existing style and conventions
  • No unnecessary formatting or unrelated changes
  • Public APIs are documented (if applicable)
  • Unit tests added where applicable and all passing
  • I’m okay with this PR being rejected or requested to change 🙂

FabiPhun added 13 commits April 10, 2026 12:02
- rewrote CameraOrbit logic
- moved panning from FirstPersonCamera to CameraOrbit
- changed logic within SceneViewportWidget / PageSceneView / EditorPreferences to adjust for new SceneEditorExtension changes
- final code clean-up
- fixed a issue where when the raycast within zoom didn't hit anything, it used the world origin as the reference point instead of the last hit performed by either orbit/zoom or pan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant