Skip to content

Zoom a scope while the right button is held

Updated

While the right mouse button is held, a script on the camera eases its Perspective Camera’s field of view from 60° to 20°, and back on release.

Hold the right mouse button to zoom in on the far target, and release it to zoom out. Drag to orbit the camera.

Zoom a scope while the right button is held

The script is explained step by step in Zoom a scope while the right button is held.

Download the project file below, then import it in XR Hub with Projects › New › Import, as described in Projects and templates. It opens in XR Creator with the same scene you see running above, each script already attached to its Behavior entity. From there you can edit the scripts, adjust components and their props, preview your changes, and deploy the result as a world of your own.

ScopeZoom.xrproj