# Recoil Settings

All settings are located in the **Recoil Data** asset (to create one, right-click and go <mark style="background-color:purple;">**Miscellaneous -> Data Asset -> Recoil Data**</mark>). This asset contains many sections, and we will cover them one by one.

## Controller Recoil

<figure><img src="https://3651122009-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmWlhCRI70uShLRiOey3T%2Fuploads%2FtGQzxOdIBDRAdYq8pQoS%2Fimage.png?alt=media&#x26;token=c7b046fd-95b0-4631-abad-a625cbfb07a5" alt="" width="427"><figcaption><p>Controller Recoil.</p></figcaption></figure>

* **Horizontal Recoil Step**: a value will be computed in this range and added to the controller Yaw.
* **Vertical Recoil Step**: a value will be computed in this range and added to the controller Pitch.
* **Recoil Smoothing**: interpolation speed for X (Yaw) and Y (Pitch).
* **Damping**: how fast the both Pitch and Yaw will go to zero,
* **Compensation**: how much player input to take into account. 1 - 100%, 0 - 0%.

**Controller Recoil** is added directly to the **Player Controller** using *AddPitchInput* and *AddYawInput* methods.

## Curve

This section contains curves that we covered in the previous chapter:

<figure><img src="https://3651122009-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmWlhCRI70uShLRiOey3T%2Fuploads%2Fuf3hCnpZyMVd7Gru8iuJ%2Fimage.png?alt=media&#x26;token=a0bf6c2d-e352-43b1-a343-f447802bd471" alt="" width="383"><figcaption><p>Vector curves for translation and rotation,</p></figcaption></figure>

## Input

These properties generate main target recoil values:

<figure><img src="https://3651122009-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmWlhCRI70uShLRiOey3T%2Fuploads%2FgywxkTJIaLKMl08mV8tW%2Fimage.png?alt=media&#x26;token=fb4e109a-53a2-4465-b70e-a706f073f68a" alt="" width="563"><figcaption><p>Input properties.</p></figcaption></figure>

* **Pitch/Yaw/Roll Aim**: a value will be generated in this range and added to the pitch/yaw/roll when aiming.
* **Pitch/Yaw/Roll**: a value will be generated in this range and added to the pitch/yaw/roll when hip firing.
* **Kick/Kick R/ Kick Up Aim**: a value will be generated in this range and added in the forward/right/up direction when aiming.
* **Kick/Kick R/ Kick Up**: a value will be generated in this range and added in the forward/right/up direction when aiming.

It's worth noting how the random generation happens in runtime:

* For 2D vectors, it will compute a value via FRandRange(X, Y)
* For 4D vectors, it will compute a value via FRandRange(FRandRange(X, Y), FRandRange(Z, W)). We do it this way to avoid getting close-to-zero values, which sometimes look horrible.

## Smoothing

This group is only applied when auto/burst firing.

<figure><img src="https://3651122009-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmWlhCRI70uShLRiOey3T%2Fuploads%2FsOG9EpgDj4bSl96QdvFv%2Fimage.png?alt=media&#x26;token=0c2cd237-3c00-466e-b57a-14dc4d25d248" alt="" width="476"><figcaption><p>Smoothing properties.</p></figcaption></figure>

* **Smooth Rot/Loc**: interpolation speed for a rotation/translation axis. If the value is zero - no interpolation will be applied.
* **Multi Rot/Loc**: multipliers for a rotation/translation axis.
* **Smooth Roll**: if roll sign should change every shot. Keep it true to achieve the best results.

## Noise Layer

This layer applies translation 2D noise in the YZ plane (right and up movement).

<figure><img src="https://3651122009-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmWlhCRI70uShLRiOey3T%2Fuploads%2F50rKI89ROjnWH6tb1CgQ%2Fimage.png?alt=media&#x26;token=c24a7703-5104-4920-b427-d7d810ed8f18" alt="" width="416"><figcaption><p>Noise properties.</p></figcaption></figure>

* **Noise 2DTarget**: this value will be added to the translation of every shot.
* **Noise 2DAccel**: interpolation speed for right and up axes.
* **Noise 2DZero**: how fast each axis will go to zero.
* **Noise Aim Scalar**: multiplier applied when aiming.

## Pushback

This layer is applied on the second shot of a burst or auto sequence.

<figure><img src="https://3651122009-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmWlhCRI70uShLRiOey3T%2Fuploads%2FI8PKIOllkjMcm0XKBDlS%2Fimage.png?alt=media&#x26;token=4cc65807-9290-41ec-9bc2-21d4f73254aa" alt="" width="305"><figcaption><p>Pushback properties.</p></figcaption></figure>

* **Pushback**: this value will be added to the forward translation.
* **Pushback Zero**: how fast the pushback should go to zero.
* **Pushback Accel**: pusback interpolation speed.

## Recoil Sway

This layer applies sway to simulate a body recoil.

<figure><img src="https://3651122009-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmWlhCRI70uShLRiOey3T%2Fuploads%2FCz7TjkOlPPylFGnIIRPp%2Fimage.png?alt=media&#x26;token=085af73f-496f-4f67-9522-f8d2f013557a" alt="" width="533"><figcaption><p>Recoil Sway properties.</p></figcaption></figure>

* **Pitch Sway**: a value will be randomly generated in this range and added to the pitch.
* **Yaw Sway**: a value will be randomly generated in this range and added to the yaw.
* **Roll Sway Multiplier**: will multiply the yaw result by this value and add it to the roll.
* **Damping**: how fast the sway should go to zero.
* **Acceleration**: interpolation sway speed.
* **Ads Scale**: this value will scale the recoil sway when aiming.
* **Pivot Offset**: will offset the recoil physical pivot.

## Timeline

These properties control the general animation timeline.

<figure><img src="https://3651122009-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmWlhCRI70uShLRiOey3T%2Fuploads%2FY16d7loQdXh201o1zGIC%2Fimage.png?alt=media&#x26;token=a18dec5e-c78a-4531-8c24-f20d68bed40e" alt="" width="291"><figcaption><p>Tineline properties.</p></figcaption></figure>

* **Playback Offset**: will offset the loop time interval. For example, if a weapon fire rate is 600RPM, the loop interval will be 0.1s + Playback Offset.
* **Play Rate**: animation speed multiplier.

## Pivot

This section controls the physical recoil pivot point.

<figure><img src="https://3651122009-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmWlhCRI70uShLRiOey3T%2Fuploads%2Fw1anlwSIrkPt8CRk8wiQ%2Fimage.png?alt=media&#x26;token=2a12b9c3-7377-48ba-b288-1fda5afd4824" alt="" width="522"><figcaption><p>Pivot settings.</p></figcaption></figure>

* **Pivot Offset**: applied when hip firing.
* **Ads Pivot Offset**: applied when aiming.

{% hint style="success" %}
**Tip**: pivot offsets can be useful when we want to apply recoil rotation around a certain point, like a shoulder.
{% endhint %}
