Developer knowledge network ยท moderated exchange

UnreliableCode Community

Developer Research, Reverse Engineering & Coding Community

Knowledge indexLive
4Categories
919Threads
2.8KPosts
Guide

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

recoil_god
Member
MEMBER
Rep: 35
Join Date: Apr 2019
Posts: 13
Thanks: 47
1 months ago ยท 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
Rep: 72
Join Date: Sep 2019
Posts: 32
Thanks: 16
1 months ago ยท 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
Rep: 105
Join Date: Aug 2018
Posts: 52
Thanks: 41
1 months ago ยท Jul 14, 2026 5:29 AM
#3

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