1 か月前 · Jul 23, 2026 9:47 PM
How to calculate recoil crosshair offset on screen without modifying client convars:
CPP
void DrawRecoilCrosshair(C_CSPlayerPawn* pLocal, Vector2 screenCenter) {
Vector2 punch = { pLocal->m_aimPunchAngle().x, pLocal->m_aimPunchAngle().y };
float fov = 90.0f; // Local FOV
// Screen pixels per angle degree
float pixelsPerDegree = (float)screenHeight / fov;
float dx = -punch.y * pixelsPerDegree * 2.0f;
float dy = punch.x * pixelsPerDegree * 2.0f;
ImVec2 crosshairPos(screenCenter.x + dx, screenCenter.y + dy);
ImGui::GetBackgroundDrawList()->AddCircleFilled(crosshairPos, 2.5f, IM_COL32(0, 255, 255, 220));
}