How to add sniper zoom effect in an FPS made with Unity3d?


I’ve been following parts of the FPS tutorial in the Unity website, while creating my own code based on the ideas and concepts illustrated by parts of the code in the tutorial.

I’ve been wondering how to add some sort of sniper zoom effect for my FPS (for example, a sniper rifle)

I’ve been struggling trying to follow the flow and ideas being shown by the tutorials I have seen regarding the snipe scope so far.

I’ve been having some idea of how the zoom may work, primarily such as

  • zooming the “Main Camera” of the game by shifting the camera’s position a certain distance away from the FPS Controller Game Object

This is the approach that i could think of. Would this be a feasible approach? Also, if it is, what kind of functions would I have to know in Unity to be able to execute the effect?

And if there is understandable code, is there “good” code written in C#

Or if there’s a “beginner-friendly” tutorial on it, can you show me the way?


PS: I will highly appreciate if someone could type some sample code about the sniper zoom effect here. Cheers again!

You’ll want to adjust the camera’s field of view to be smaller to simulate looking through some kind of scope.

Just lower your camera.fieldOfView and that’s it ! Animate that value using a tween to get that animating zoom effect, and you’re all set.