How To Zoom

A forum to store posts deemed exceptionally wise and useful
Post Reply
mohaps
Posts: 248
Joined: Tue Jun 08, 2004 1:54 pm
Location: Shrewsbury MA
Contact:

How To Zoom

Post by mohaps »

Zooming the camera like for a sniper scope is very simple.

it can be done with a few lines of code like

f32 defaultFOV = camera->getFOV(); // this is in radians
f32 defaultAspect = camera->getAspectRatio();

f32 zoomFOV = 0.25f * M_PI;
camera->setFOV(zoomFOV);

//to unzoom reset the FOV to the defaultFOV

you might want to play around with the aspect ratio to make the imabe non squishy / stretched.


Additionally you can use an overlay image for the sniper scope.... it is also a good idea to make the weapon invisible in FPS type games while zooming.
---
Saurav Mohapatra
author, artist and bona fide geek

web: http://www.mohaps.com
email: mohaps AT gmail DOT com
Post Reply