Configuration examples/Scale mouse sensitivity with zoom

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.

Contents

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.

Technical explanation that you may skip, expand this box if you wish

The code that is used to scale zoom sensitivity in Quake 3 and OpenArena is vertical_zoomfov / 75.0. The result gets multiplied to both mouse acceleration and sensitivity. This formula is a bit flawed because it assumes the user is playing on 75 vertical fov [which is equivalent to cg_fov ~107 on 16:9 and ~91 on 4:3 with "classic" OA binaries up to 0.8.8 (VERT-), or to cg_fov ~91 on both 16:9 and 4:3 with "new" OA3 binaries (HOR+) - see Wikipedia]. A formula that would create more consistent results independently from cg_fov is vertical_zoomfov / vertical_basefov.

But there is another formula that is more correct than scaling the sensitivity linearly. It is tan(vertical_zoomfov / 2) / tan(vertical_basefov / 2).

So, we are taking advantage of this by manually tweaking m_yaw and m_pitch values using this formula: m_yaw * (tan(zoomfov / 2) / tan(basefov / 2) (and the same with m_pitch in the place m_yaw).It doesn't matter if vertical or horizontal fov is used to scale, the result will be the same.
If you are trying to use the formula on your own: depending from the system you are using to make the calculations, you may or may not need to explicitly convert fov from degrees to radians first, in order to obtain the right results.

For the scaling to work properly it has to affect both mouse sensitivity and acceleration. Adjusting m_yaw and m_pitch by a factor will change mouse sensitivity and acceleration by that factor. You could also change cl_mouseaccel and sensitivity by the same factor instead, but it's probably cleaner to adjust m_yaw and m_pitch because then you can freely change sensitivity and cl_mouseaccel and the zoom sensitivity will be updated accordingly ("mouse speed" slider in Control Options modifies sensitivity CVAR).

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.

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.

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)).

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.

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.

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'.

Expand this if you wish to use the Python computing script

Here we will be using the fovsenscalc-script to do the calculation of m_pitch and m_yaw at the our zoom levels. In the calculation example $ is the shell prompt and it is assumed that the user is inside the directory containing the fovsenscalc script-file.