Developer knowledge network · moderated exchange

UnreliableCode コミュニティ

開発者リサーチ、リバース エンジニアリング、コーディング コミュニティ

Analysis

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

rust_il2cpp_dev
IL2CPP Master
MEMBER
担当者: 165
参加日: Oct 2020
投稿: 7
ありがとう: 16
1 か月前 · 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
担当者: 105
参加日: Aug 2018
投稿: 52
ありがとう: 41
1 か月前 · 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
担当者: 126
参加日: Mar 2021
投稿: 14
ありがとう: 78
1 か月前 · Jul 3, 2026 10:36 PM
#3

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