Created
March 12, 2015 21:52
-
-
Save renews/a8142d06149857f6d3f5 to your computer and use it in GitHub Desktop.
Camera FOV Unity - Control by Mouse
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var minFov: float = 15f; | |
var maxFov: float = 90f; | |
var sensitivity: float = 10f; | |
function Update () { | |
var fov: float = Camera.main.fieldOfView; | |
fov += Input.GetAxis("Mouse ScrollWheel") * sensitivity; | |
fov = Mathf.Clamp(fov, minFov, maxFov); | |
Camera.main.fieldOfView = fov; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment