View roll: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (clean up, added orphan, uncategorised, deadend tags)
No edit summary
Line 1: Line 1:
{{Multiple issues|
This page details on how to add the view rolling effect, which is used in {{hl|1}}, {{bms|1}}, and {{quake|1}} to your mod.
{{Dead end|date=January 2024}}
{{Orphan|date=January 2024}}
}}
 
Have you ever wanted to add that cool Black Mesa view rolling effect into your mod? Well now you can!


{{note|''Works on all branches.''}}
{{note|''Works on all branches.''}}
Line 11: Line 6:
First, go to '''movevars_shared.cpp''' and search around line 82 for this:
First, go to '''movevars_shared.cpp''' and search around line 82 for this:


<source lang=cpp>
<syntaxhighlight lang=cpp>
ConVar sv_rollangle ( "sv_rollangle", "0", FCVAR_NOTIFY | FCVAR_REPLICATED | FCVAR_DEVELOPMENTONLY, "Max view roll angle");
ConVar sv_rollangle ( "sv_rollangle", "0", FCVAR_NOTIFY | FCVAR_REPLICATED | FCVAR_DEVELOPMENTONLY, "Max view roll angle");
</source>
</syntaxhighlight>


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


<source lang=cpp>
<syntaxhighlight lang=cpp>
ConVar sv_rollangle ( "sv_rollangle", "3", FCVAR_NOTIFY | FCVAR_REPLICATED | FCVAR_DEVELOPMENTONLY, "Max view roll angle");
ConVar sv_rollangle ( "sv_rollangle", "3", FCVAR_NOTIFY | FCVAR_REPLICATED | FCVAR_DEVELOPMENTONLY, "Max view roll angle");
</source>
</syntaxhighlight>


{{tip| If you want users to be able to change the value when <code>sv_cheats</code> is enabled, replace FCVAR_DEVELOPMENTONLY with FCVAR_CHEAT}}
{{tip| If you want users to be able to change the value when <code>sv_cheats</code> is enabled, replace FCVAR_DEVELOPMENTONLY with FCVAR_CHEAT}}
Line 26: Line 21:
After that, compile your mod and you ''should'' have view rolling in your mod.
After that, compile your mod and you ''should'' have view rolling in your mod.


{{Uncategorized|date=January 2024}}
[[Category:Camera]] [[Category:Programming]]

Revision as of 06:57, 10 April 2025

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.