When you use zoom feature, you may notice the mouse sensitivity may give you a different feeling, maybe you may feel it becoming a bit "slower", with the difference becoming bigger as you use different cg_fov values than the standard one.
You may be perfectly fine with this, as you may like a slower movement to have more aiming precision while zooming, but maybe you may prefer keeping the same feeling instead. In this page we will show you a configuration trick that will allow you to keep the same mouse sensitivity while zooming. As the workaround includes manually re-creating a zoom feature without using the built-in zoom feature, you can also use it to add an extra or intermediate level of zoom (with or without the mouse sensitivity tweak; the last case is quite simple).
Why is this necessary? How does it work?Edit
OpenArena inherited its code from Q3A, and the code which adjusts mouse sensitivity while zooming may have been better. You may be fine with that, but you are not, you can apply this workaround which uses a script which sets a button to change your field of view instead of using built-in zoom feature. So, you will no more have to hold the standard zoom button, but to press a button once to enable zoom and again to disable it.
If you move away from using +zoom and instead use a toggle bind that changes cg_fov you can then adjust m_yaw and m_pitch to get the optimal feel according to the formula. This is however only possible when switching to a toggle bind so if you prefer to hold your zoom button for zooming there is no solution for you.
Another small drawback of this workaround is that you may occasionally find yourself starting a new match or respawning after death with zoom already active, if you had it before.
As zoom feature is managed by "gamecode", even if OA3 may include a simpler workaround for mouse sensitivity during zoom, probably this one will still be the only way to go if you will need it in old mods.
The use of the formula is not strictly related with our "manual zoom" trick: you may wish to use it just to keep the same mouse feeling after you changed your cg_fov value for any other reason.
This stuff works with both Quake 3 Arena and OpenArena.
Involved settings and default valuesEdit
Let's recap the default values of the involved variables in OA 0.8.8:
- m_yaw: 0.022
- m_pitch: 0.022
- cg_fov: 90 (horizontal field of view: 90 gives a "natural" look, but many players set it higher, even to 120 or similar, to see more enemies around them!)
- cg_zoomfov: 22.5 (horizontal fov while holding the zoom button: our script isn't going to alter or to use this, but your value of this cvar is probably the zoom level you wish to emulate)
- bind MOUSE2 +strafe (in the example, we will use MOUSE2 button for our custom zoom feature, of course you can use the key/button you prefer!)
- bind MOUSE3 +zoom ("+zoom" is the standard OA zoom feature, that our script desn't affect. You can use it to compare the different "feeling".)
Just for completeness (our script isn't going to alter these cvars):
- sensitivity: 5 (but you probably already changed it, due to such value being quite slow)
- cl_mouseaccel: 0
- cl_mouseaccelOffset: 0
- cl_mouseaccelstyle: 5
The script creates a few "user-defined variables" and a "key binding" to set a button run the required commands. You can add the script directly to your q3config.cfg file, or in autoexec.cfg, or in another file that you have to manually launch with /exec <filename.cfg> command. Keep in mind that user-defined variables will be stored to your q3config.cfg file if they were already there or you created them with "seta" command, and not if you created them with "set" command and they did not exist yet. Key bindings are automatically stored to your q3config.cfg file.
See Set variables and Key binding for more infos, including how to remove user-defined variables and key bindings.
Calculate the new valuesEdit
To actually calculate the right m_yaw and m_pitch values you have to enter, the formula is m_yaw * (tan(zoomfov / 2) / tan(basefov / 2) (and the same with m_pitch in the place m_yaw). You can use your cg_zoomfov and cg_fov values for zoomfov and basefov, respectively.
Important: OA FOV values are in degrees and trigonometric functions as "tan" usually work with radians. So you will probably need to convert the two values to radians first; however some systems may assume the input is in degrees, so explicitly converting to radians may lead to erroneous results in that case. Check your results with our examples in this page to be sure you are doing right.
Let's take the case of an .ODS Spreadsheet, requiring to explicitly converting degrees to radians: in case A2 contains pitch, B2 contains standard fov and C2 contains zoom fov, the right formula to use there will be =A2*(TAN(RADIANS(C2)/2)/TAN(RADIANS(B2)/2)).
Using this ODS SpreadsheetEdit
If you wish, you can use the .ODS Spreadsheet prepared by Gig and ryvnf to calculate the new values. You can find it here: https://www.dropbox.com/s/a2uih9jkoq27mws/ScaleMouseSensitivityWithFOV_Zoom-OA_Q3A_V1.1.ods?dl=0 (25 KB) - You can open it using LibreOffice or other office suites.
It's very easy, it even creates the "manual zoom script" with your values, so you can just copy-paste it into your OpenArena (or Q3A) configuration files!
Using this Python scriptEdit
It is possible to download the script and execute it using a Python interpreter using python fovsenscalc or ./fovsenscalc on Unix/Linux; Python for Windows can be downloaded here.
Finally, let's go to make this: a key binding to a script which changes cg_fov, m_pitch and m_yaw to "emulate zoom" and "scale" your sensitivity accordingly, and then zooms out the next time you press the button.
Using default FOVsEdit
This examples switches from the default horizontal FOV value (90) to the default zoom value (22.5) with the default m_yaw and m_pitch value (0.022).
To calculate our new m_yaw and m_pitch value. We multiply the old value by the result of the formula:
0.022 * (tan(22.5 degrees / 2) / tan(90.0 degrees / 2)) = 0.022 * 0.19891236738 = 0.00437607208236000
Our script to bind mouse2 to toggle zoom becomes as follows:
set cg_fov 90 set m_yaw 0.022 set m_pitch 0.022 //The three lines above are not strictly necessary set zoom "vstr zoom1" set zoom0 "set zoom vstr zoom1; set cg_fov 90.0; set m_yaw 0.022000; set m_pitch 0.022000" set zoom1 "set zoom vstr zoom0; set cg_fov 22.5; set m_yaw 0.004376; set m_pitch 0.004376; bind mouse2 "vstr zoom"
How many decimals to use in the script to use it up to you. The more decimals you use the more accurate the sensitivity scaling will be. But as more decimals are added the difference in accuracy quickly becomes unnoticeable.
Using an high FOVEdit
This example switches form a large FOV value to the default zoom value. The unzoomed FOV is 120 and the zoomed FOV is 22.5. m_yaw and m_pitch when unzoomed are the default value of 0.022.
We calculate our new m_yaw and m_pitch using the formula as the previous example.
0.022 * (tan(22.5 degrees / 2) / tan(90.0 degrees / 2)) = 0.022 * 0.114842108852 = 0.00252652639474
Our configuration script to bind mouse2 to toggle zoom becomes as follows:
set cg_fov 120 set m_yaw 0.022 set m_pitch 0.022 //The three lines above are not strictly necessary set zoom "vstr zoom1" set zoom0 "set zoom vstr zoom1; set cg_fov 120.0; set m_yaw 0.022000; set m_pitch 0.022000" set zoom1 "set zoom vstr zoom0; set cg_fov 22.5; set m_yaw 0.002526; set m_pitch 0.002526" bind mouse2 "vstr zoom"
Inserting an additional zoom levelEdit
It is possible to take advantage of the script to get a feature not included with the game itself: different levels of zoom. You can do it by adding an extra support variable which includes an intermediate (or even higher) level of zoom, in a way that pressing the button will allow you to cycle between standard view -> zoom level 1 --> zoom level 2 --> standard view.
Here we will be using 90 FOV for 'standard view', 45 FOV for 'zoom level 1' and 22.5 FOV for 'zoom level 2'. m_pitch and m_yaw are 0.022 in the 'standard view'.
Our configuration script now becomes:
set cg_fov 90 set m_yaw 0.022 set m_pitch 0.022 //The three lines above are not strictly necessary set zoom "vstr zoom1" set zoom0 "set zoom vstr zoom1; set cg_fov 90.0; set m_yaw 0.022000; set m_pitch 0.022000" set zoom1 "set zoom vstr zoom2; set cg_fov 45.0; set m_yaw 0.009113; set m_pitch 0.009113" set zoom2 "set zoom vstr zoom0; set cg_fov 22.5; set m_yaw 0.004376; set m_pitch 0.004376" bind mouse2 "vstr zoom"