Unity – Trackball Camera


The nCamera solution provides two additional modes for operating the scene-view camera in Unity: Trackball & Six-Axis.
It also provides improved zoom behaviour for quickly navigating your scene without hassle.


Inspired by Modo’s trackball camera I wrote a Unity solution that overrides Unity’s scene camera rotation when enabled.

Grab and move the viewport to manipulate it to any angle. Vertical and horizontal motions centered in their axes will let the camera behave simply, any motions outside of the vertical-horizontal cross will result in rolling.


Six-axis mode realigns the scene-view’s “up” to an appropriate axis when the camera tilts over 90 degrees. This effectively creates a default scene camera that can view the scene from any of the six-axes. Still incapable of rolling the camera in use, but able to roll when you look “too far” up or down.


Using trackball rotation is helpful when you want to see the world from a different perspective, instead of Y always being upwards. Six-Axis is an easier to grasp version of a freed-perspective camera. Hopefully it works out for you, and if it does I would be happy to hear about improvements anyone makes!

NCamera  will automatically enable itself, and there should be a toggle button below your XYZ gizmo. This can also be right-clicked as a context menu similar to the perspective options.

Additional Controls:

Holding CTRL whilst in Trackball or Six-Axis and pressing an Axis Selection handle (top right) will align the up-vector of the camera to that direction instead of the default look-down-axis behaviour.

Zoom-to-Cursor can be overriden by holding CTRL+ALT when zooming instead of just the standard ALT.
You can also enable/disable Zoom-To-Cursor behaviour per-camera system in the Preferences window.

As you can see, compared to the above videos, the Default camera behaviour requires you to “walk” the camera – making it tedious and irritating to inspect items. Even alone, the zoom-to-cursor behaviour improves the camera massively.


2017-12-27 – RELEASE
2017-12-28 – Right-click pan support, Fly Cam support
2017-12-30 – Use less events to override less custom behaviour provided by other scripts.
2017-12-31 – Resolved Scene-View axis selection buttons not functioning properly in 6-axis mode.
– Fixed camera passing pivot, resulting in negative rotations.
– Fixed Right-Mouse controls getting stuck when switching modes.
– Added Zoom-to-Cursor for Six-Axis and Trackball controls (may be updated later.)
2018-01-02 – Added Preferences window that allows you to enable/disable Zoom-To-Cursor on SixAxis, Trackball, and Default cameras.
2018-01-03 – Six-Axis and Trackball Axis Selection gizmo override when holding CTRL, you can now select the Up vector of the camera.
– Now I’m not breaking 2D Support, or Scene-View locking.
2018-01-05 – Added compatibility for 5.6-2017.2. Fixed lighting issue and input issue on mode switching button.
2018-03-07 – Hopefully fixed inconsistent axis alignment speeds and added text description of current mode underneath the mode switch button.
2018-03-08 – Fixed <2017.3 compatibility. Added toggle setting for six-axis auto alignment. When this is off you will need to use the CTRL-CLICK Axis Selection Gizmo to change Up directions.
2018-03-25 – Rewrote Zoom-to-Cursor behaviour, it should be simpler and more reliable.
Zoom-to-Cursor respects backface culling, but there are options to disable this.
Zoom-to-Cursor can be overriden by holding CTRL+ALT when zooming instead of just the standard ALT.
2018-03-30 – Fixed Zoom-To-Cursor raycast issues against UI.
– Up-Vector Realignment speed is implemented with internal Unity functionality.
– Fixed compatibility with versions below 2017.1
– Fixed UI buttons being lit again

If you wish to uninstall, I advise you set the camera back to default before you do so (but you can probably reset a tumbled camera using the standard view control GUI.


Known Issues/Improvements
Tested with 2017.3, 2017.2.0b9, 2018.1.0b4, and 5.6.0b6.