View roll

From Valve Developer Community
Revision as of 06:57, 10 April 2025 by Kr0tchet (talk | contribs)
Jump to navigation Jump to search

This page details on how to add the view rolling effect, which is used in Half-Life, Black Mesa, and Quake to your mod.

Note.pngNote:Works on all branches.

The code

First, go to movevars_shared.cpp and search around line 82 for this:

ConVar sv_rollangle ( "sv_rollangle", "0", FCVAR_NOTIFY | FCVAR_REPLICATED | FCVAR_DEVELOPMENTONLY, "Max view roll angle");

Change the 0 to anything between 0 and 10. Example:

ConVar sv_rollangle ( "sv_rollangle", "3", FCVAR_NOTIFY | FCVAR_REPLICATED | FCVAR_DEVELOPMENTONLY, "Max view roll angle");
Tip.pngTip: If you want users to be able to change the value when sv_cheats is enabled, replace FCVAR_DEVELOPMENTONLY with FCVAR_CHEAT

After that, compile your mod and you should have view rolling in your mod.