🔫Recoil Animation

In this section we will cover the recoil animation details.

How Does It Work?

The PRAS (Procedural Recoil Animation System) uses an advanced, yet simple way to generate realistic recoil. The system takes Vector Curves for translation and rotation, plays them in runtime, and uses curve values as interpolation alphas to reach the randomly generated targets.

RecoilAnimation = Lerp(0f, TargetValue, CurveValue)

where Target Value is randomly generated when a shot is fired.

Example recoil curve.

Recoil curves should be in the range [-1;1], so a curve value can be used as an interpolation alpha. The curve peaks at 1 and then goes down to 0 with some oscillation.

Single and Auto Fire

Recoil Data is an asset, which contains all information about the recoil animation. This includes curves and other settings:

Curve section in the Recoil Data.

To create a new Recoil Data, right-click and go to Miscellaneous -> Data Asset -> Recoil Data. This asset includes 4 Vector Curves in total: 2 for translation and 2 for rotation. The PRAS has 2 main fire modes:

  • Single

  • Auto/Burst (there's no technical difference animation-wise)

Let's compare an example single and auto fire curve:

The curves are almost identical! The only difference is that auto curve values are very close to 0 at some time - this time equals the fire rate of a weapon (in this case 600RPM = 0.1s). This will ensure that the weapon's main muzzle climbing will be fully preserved when auto-firing.

Last updated