Developer knowledge network · moderated exchange

Społeczność UnreliableCode

Badania programistów, inżynieria wsteczna i społeczność programistów

Knowledge indexNa żywo
4Categories
919Threads
2.8KPosty
Analysis

Rust Weapon Recoil yawCurve & pitchCurve Animation Interpolation Math [v2.4 Technical Discussion]

rust_il2cpp_dev
IL2CPP Master
MEMBER
Rozpustnik: 165
Data dołączenia: Oct 2020
Posty: 7
Dzięki: 16
1 miesięcy temu · Jul 3, 2026 3:16 AM
#1

In Rust IL2CPP, weapon recoil uses Unity AnimationCurve keys inside RecoilProperties:

  • pitchCurve: Keyframe array of vertical angles over shot index.
  • yawCurve: Keyframe array of horizontal angles.
  • timeToTake: Interpolation duration per shot.

To compute exact anti-recoil compensation in C++:

CPP
float EvaluateCurve(AnimationCurve* pCurve, float time) {
    for (int i = 0; i < pCurve->m_nKeys - 1; i++) {
        if (time >= pCurve->keys[i].time && time <= pCurve->keys[i+1].time) {
            float t = (time - pCurve->keys[i].time) / (pCurve->keys[i+1].time - pCurve->keys[i].time);
            return Lerp(pCurve->keys[i].value, pCurve->keys[i+1].value, t);
        }
    }
    return 0.0f;
}
matrix_math_guy
Math Specialist
MEMBER
Rozpustnik: 105
Data dołączenia: Aug 2018
Posty: 52
Dzięki: 41
1 miesięcy temu · Jul 3, 2026 5:05 AM
#2

Evaluating the exact Unity AnimationCurve keys matches the server recoil model identically. Great analysis.

colorbot_crafter
Hardware Modder
MEMBER
Rozpustnik: 126
Data dołączenia: Mar 2021
Posty: 14
Dzięki: 78
1 miesięcy temu · Jul 3, 2026 10:36 PM
#3

Eliminates all recoil on AK-47 30-round spray sprays.