Jump to content
Sign in to follow this  
dupa

Finding out the current camera FOV

Recommended Posts

If by 'Camera' you mean the splendid camera, it says it right in the lower left corner. If you also want to know the FoV while playing, check your config. (FoVtop and FoVleft)

Share this post


Link to post
Share on other sites

I mean while playing. But the config isn't helpful here. I want to know the FOV level of the current camera view, which could be for example:

- Regular 1st person view

- 1st person view zoomed in

- RCO optics

- RCO collimator sight

- Gunner optics in vehicles (several FOV levels)

I hope this explains the idea more clearly.

Share this post


Link to post
Share on other sites

Thanks for the info, I'll look into it.

Share this post


Link to post
Share on other sites

I had a look at the CBA function and that's EXACTLY what I needed. Thanks a lot!

Share this post


Link to post
Share on other sites

I've spent a bit of time looking at FOVs for the feedback tracker. If you just want to see what FOVs the game uses, I created my own FOV monitoring script in a repro mission. It provides endless looping hintSilent output, rather than working as a function. While it is more precise than CBA_fnc_getFov, it relies on the camera looking at land to give a result (and doesn't work over/in the ocean). It also calculates the current zoom level (to match in game HUDs).

Please also note CBA_fnc_getFov returns the current vertical FOV in radians, and the result needs to be manipulated to give the true edge of screen to edge of screen FOV (and as advertised, it is fairly imprecise).

Having taken another look at it now, unless I'm missing something, it can easily be improved as it does a lot of unnecessary work to get a poor result. Here's a simplified and precise derivative, which returns current horizontal FOV in degrees only:

/**************************************************************************
Description:
Return current Field Of View (FOV), derived from CBA_fnc_getFov

Input:
- argument: nil

Output:
- returns: (NUMBER) current screen horizontal FOV in degrees
**************************************************************************/


private ["_wreal", "_xoff", "_depth", "_pos2", "_xpos2", "_deltax", "_hFov"];

_wReal = safeZoneW / 2;  //== half of current screen width
_xOff = 5000; //camera x offset for sample point, bigger is better!
_depth = 10000; //camera z offset for sample point, bigger is better!

_pos2 = positionCameraToWorld [_xoff, 0, _depth]; //position offset from camera
_xpos2 = (worldToScreen _pos2) select 0; //screen position of that point 
_deltaX = _xpos2 - 0.5;  //difference on screen between _pos2 and centre of screen
_hFov = 2 * atan ((_wreal * _xoff / _deltaX) / _depth); //calc horz FOV using trig
_hFov

Edited by ceeeb

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×