Go to the gamemovement.cpp file(line ~64). At the beginning of the file, add the following:
// Camera Bob
ConVar cl_viewbob_enabled("cl_viewbob_enabled", "1", 0, "Oscillation Toggle", true, 0, true, 1);
ConVar cl_viewbob_timer("cl_viewbob_timer", "10", 0, "Speed of Oscillation");
ConVar cl_viewbob_scale("cl_viewbob_scale", "0.05", 0, "Magnitude of Oscillation");
At the beginning of the WalkMove (line ~1905) function, add:
if (cl_viewbob_enabled.GetInt() == 1 && !engine->IsPaused())
{
float xoffset = sin(gpGlobals->curtime * cl_viewbob_timer.GetFloat()) * player->GetAbsVelocity().Length() * cl_viewbob_scale.GetFloat() / 200 - 0.01;
float yoffset = sin(2 * gpGlobals->curtime * cl_viewbob_timer.GetFloat()) * player->GetAbsVelocity().Length() * cl_viewbob_scale.GetFloat() / 500;
player->ViewPunch(QAngle(0, yoffset, xoffset));
}
After that, adjust the Convars values to suit your settings.
