@siread - camera fov

BlitzMax Forums/MiniB3D Module/@siread - camera fov

jkrankie(Posted 2010) [#1]
I was reading the new star games blog, and spotted your post about changing the cameras fov allowing for flatter angles. I've been going through the MiniB3D source and can't find where to change it. any clues?

Cheers
Charlie


Kryzon(Posted 2010) [#2]
I think it's on TCamera.BMX, where you can see that the default value for the Zoom# field is 1.0, whenever you create a new camera.

What happens is that FOV and Zoom values relate to each other through the following equation:
Zoom# = 1.0/Tan(fov#/2.0)
If you want a camera to use a certain FOV angle, all you need to do is input it into the Fov variable in this equation and you will get the appropriate Zoom value that corresponds to it.

The default Zoom value of 1.0 for Blitz3D\MiniB3D results in a 90º degree FOV.


jkrankie(Posted 2010) [#3]
Ah, cool! I'll give that a try :) Thanks a lot

Cheers
Charlie


jkrankie(Posted 2010) [#4]
Excellent, works great :)

Cheers
Charlie


siread(Posted 2010) [#5]
You don't have to edit the source though. You can use the CameraZoom function...
CameraZoom(camera, 1.0 / Tan(fov#/2.0))

Where 'camera' is of course your camera object. :)


jkrankie(Posted 2010) [#6]
Yeah, i worked it out :)

Cheers
Charlie