x


Can the camera in Unity be made to zoom in and out?

Is it possible to have the Unity camera change its lens angle? (ie: a zoom lens) If so, how to implement?

I would like to have a more telephoto lens for part of my project.

Ryder

more ▼

asked Jun 09 '10 at 02:14 AM

Ryder gravatar image

Ryder
182 4 5 16

(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

From the inspector, you can change the Field of view setting on the camera

From code, you can change camera.fieldOfView (which takes a float value)

Documented here: http://unity3d.com/support/documentation/ScriptReference/Camera-fieldOfView.html

more ▼

answered Jun 09 '10 at 02:18 AM

Mike 3 gravatar image

Mike 3
30.5k 10 65 253

(comments are locked)
10|3000 characters needed characters left

Yes you can...

by using Camera.fieldOfView. The following will set the lens to a 30 degree field of view, which is noticibly "zoomed in".

Camera.main.fieldOfView = 30; 
more ▼

answered Jun 09 '10 at 02:19 AM

Ryder gravatar image

Ryder
182 4 5 16

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x2995
x183

asked: Jun 09 '10 at 02:14 AM

Seen: 5395 times

Last Updated: Jun 09 '10 at 02:14 AM