Notifications
Ultimate Pan Scroll Zoom
Showcase
17
0
Three months and several thousand lines of code in the making!
Turns out the functionality for panning/scrolling/zooming a camera (in both 2D and 3D) is non-trivial to implement, especially if you want to come up with a general system that works with a lot of use cases.
PanZoom works by letting you define a set of axes (orthonormal by default, but not by requirement), and then define inputs to trigger translation along those axes. Compatible with Unity's native input system, but also the popular package Rewired. Touch and gamepad support bundled in out of the box.
A 3D collider (mesh, box, sphere, etc.) works as a bounding volume to constrain your camera to a relevant area; zooming is restricted by distance from an object of focus.
Involved quite a lot of editor scripting, serialization, and vector math. One of my more difficult projects, to be sure!
Alexander Rupp-Coppi
Owner/Developer, Dossamer LLC - Programmer
2
Comments