Implementing Weapon Zoom in our FPS

Any questions regarding our implementation of weapon zoom?

Ok, I played a little with the zoom and the BroadcastMessage(), and the result is a magical zoom with “sonar”:

1 Like

Whoa, that’s a totally different look, @Montse. Nice work!

I had a go at refactoring my zooming code into a generic method to handle both zoom in and zoom out. It works perfectly if you only half the sensitivity on zoom in but not any other fraction. There’d be a cleaner way to do that (without using magic numbers…maybe const, but that wouldn’t work if the player adjusted the sensitivity in player settings, right?), I’m not smart enough to figure that out.

private void AdjustZoom(float zoomFov, float zoomMultiplier)
		_isZoomedIn = !_isZoomedIn;
		_camera.fieldOfView = zoomFov;
		_rbFps.mouseLook.XSensitivity *= zoomMultiplier;
		_rbFps.mouseLook.YSensitivity *= zoomMultiplier;
1 Like

I don’t know exactly what is the problem with your zoom, perhaps in your zoom out? Have you tried to save the zoomFov before you zoom in? Then you can use it to zoom out (or to zoom in with another zoomMultiplier).