> For the complete documentation index, see [llms.txt](https://kinemation.gitbook.io/pras-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kinemation.gitbook.io/pras-documentation/tutorials/getting-set-up.md).

# Getting Set Up

{% hint style="success" %}
**Tip**: make sure to already implement basic firing logic in your project.
{% endhint %}

## Step 1 - Recoil Animation Component

First, it is essential to add the **Recoil Animation Component** to the character.

{% tabs %}
{% tab title="Blueprints" %}

<figure><img src="/files/9AIoxInjzFLHHyFOvwCJ" alt="" width="419"><figcaption></figcaption></figure>
{% endtab %}

{% tab title="C++" %}

```cpp
UCLASS(config=Game)
class AYourCharacterClass : public ACharacter
{
    GENERATED_BODY()

public:
    AYourCharacterClass();

protected:
    UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Recoil")
    TObjectPtr<URecoilAnimationComponent> RecoilComponent;

    ...
};
```

{% endtab %}
{% endtabs %}

Then, in your character class click on the RecoilAnimation component and specify the Helper UI:

<figure><img src="/files/E55tULMMrnHuCy6F57am" alt="" width="384"><figcaption><p>Select this blueprint.</p></figcaption></figure>

The Helper UI is useful when you want to modify the recoil values in runtime in a very convenient way:

<figure><img src="/files/vsDM6TkOjidcz8O2hYW0" alt="" width="533"><figcaption></figcaption></figure>

To enable this Helper UI in the game you can use the Blueprint-exposed methods:

<figure><img src="/files/UOmn1tme40ZXVfp4uOK1" alt="" width="485"><figcaption><p>How to use helper UI.</p></figcaption></figure>

## Step 2 - Initialize and Play

Make sure to call the `Init` method of the **Recoil Animation Component** to initialize the recoil animation:

<figure><img src="/files/vIutw7LqZIOZMyyOcj5D" alt="" width="563"><figcaption><p>Init function.</p></figcaption></figure>

* **Data**: **Recoil Data** asset.
* **Rate**: fire rate or RPM (Rounds-per-minute).
* **Burst:** length of the burst sequenc&#x65;**.**

Next, call `Play` and `Stop` methods when firing:

<figure><img src="/files/kZHSPwN8T08gsi947yR7" alt="" width="491"><figcaption><p>Firing logic.</p></figcaption></figure>

{% hint style="danger" %}
**Note**: Play must be called every shot!
{% endhint %}

## Step 3 - Animation Blueprint Integration

Make sure to add a **Recoil Animation** node to the Anim Graph:

<figure><img src="/files/0RCpZe9giFwQbHF8hpRq" alt="" width="234"><figcaption><p>This node will apply recoil.</p></figcaption></figure>

If you already have an *IK* system set up, select the *IK* or a *VB* (virtual bone) you want to animate with recoil in the node settings:

<figure><img src="/files/31LwKHeuOIuxweSwK8Fy" alt="" width="431"><figcaption><p>Node settings.</p></figcaption></figure>

### If you need help with IK

First, add Virtual Bones to the character head:

<figure><img src="/files/bkHmAf1ZP27VEKi5dyL7" alt="" width="305"><figcaption><p>VB stands for Virtual Bone.</p></figcaption></figure>

* **VB WeaponPivot** targets ik\_hand\_gun.
* **VB hand\_r** targets hand\_r.
* **VB hand\_l** targets hand\_l.

Add **CopyBone** nodes before the **Recoil Animation** nodes:

<figure><img src="/files/odGQisKeqv5wld0vX4Jv" alt="" width="563"><figcaption><p>These will copy animation from FK bones to VBs.</p></figcaption></figure>

If your animations do not keyframe the **ik\_hand\_gun** bone (it is used for baking gun movement into the character animation), you will have to use **hand\_r** as a source bone in the first **CopyBone** node. You can additionally offset the **VB WeaponPivot** with a custom offset if you want more flexibility.

Finally, use **Two Bone IK** after the **Recoil Animation** node:

<figure><img src="/files/RfpWKgryHuoLDu8EMS8M" alt="" width="524"><figcaption><p>IK pass.</p></figcaption></figure>

<figure><img src="/files/8El7zczzOu77kCyONVY8" alt="" width="430"><figcaption><p>Preferred IK settings.</p></figcaption></figure>

***

At this point, the setup is complete. If recoil is still not playing, double-check the steps above or:

* Check if **Recoil Data** has any values.
* The correct bone is animated by the **RecoilAnimation**.
* **Play** method is called every shot.
* The **Fire Rate** is in rounds-per-minute and greater than zero.

If the problem persists, feel free to post a ticket on our [Discord](https://discord.gg/kinemation-1027338787958816860).
