Developer knowledge network · moderated exchange

Супольнасць UnreliableCode

Супольнасць распрацоўшчыкаў даследаванняў, зваротнага праектавання і кадавання

Knowledge indexжыць
4Categories
919Threads
2.8KПаведамленні
Guide

CS2 RCS (Recoil Control System) math with punch angle subtraction

recoil_god
Member
MEMBER
прадстаўнік: 35
Дата далучэння: Apr 2019
Паведамленні: 13
Дзякуй: 47
1 месяцаў таму · Jul 13, 2026 12:29 PM
#1

Standalone recoil control in CS2 is calculated using m_aimPunchAngle from C_CSPlayerPawn:

CPP
Vector3 aimPunch = Read<Vector3>(localPawn + m_aimPunchAngle);
int shotsFired = Read<int>(localPawn + m_iShotsFired);

if (shotsFired > 1) {
    Vector3 punchDelta = (aimPunch - oldPunch) * 2.0f;
    
    // Normalize and apply smoothing to viewangles
    viewAngles.x -= punchDelta.x * rcsScaleX;
    viewAngles.y -= punchDelta.y * rcsScaleY;
    ClampAngles(viewAngles);
    SetViewAngles(viewAngles);
    oldPunch = aimPunch;
} else {
    oldPunch = Vector3(0, 0, 0);
}

Setting rcsScaleX/Y to 1.0f produces a perfect zero-recoil laser beam.

raycast_ryan
Ballistics Dev
MEMBER
прадстаўнік: 72
Дата далучэння: Sep 2019
Паведамленні: 32
Дзякуй: 16
1 месяцаў таму · Jul 13, 2026 3:57 PM
#2

Make sure you multiply punch by 2.0f because Source engine scales aim punch by 2.0 internally on bullet recoil.

matrix_math_guy
Math Specialist
MEMBER
прадстаўнік: 105
Дата далучэння: Aug 2018
Паведамленні: 52
Дзякуй: 41
1 месяцаў таму · Jul 14, 2026 5:29 AM
#3

Smooth it out with a 0.85 multiplier to keep mouse movement looking human.