# 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="https://3651122009-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmWlhCRI70uShLRiOey3T%2Fuploads%2F4wyQRZRa2i08pclSWsQj%2Fimage.png?alt=media&#x26;token=a18eb5bc-9d03-4725-a1d1-6ed14f92dc5a" 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="https://3651122009-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmWlhCRI70uShLRiOey3T%2Fuploads%2F9Gmeeb2aeyrSNgY2rKZT%2Fimage.png?alt=media&#x26;token=19855adf-c124-4b72-8197-61d089727171" 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="https://3651122009-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmWlhCRI70uShLRiOey3T%2Fuploads%2FLRJ92IQm7scBIPm2Ggci%2Fimage.png?alt=media&#x26;token=ca8d9f41-ad58-467a-aaf1-dfe2acf7f97e" alt="" width="533"><figcaption></figcaption></figure>

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

<figure><img src="https://3651122009-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmWlhCRI70uShLRiOey3T%2Fuploads%2FSKhTkMdSkG87OHj1IOBh%2Fimage.png?alt=media&#x26;token=f9e799a4-7c55-4a5c-a947-b6fe0c53a845" 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="https://3651122009-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmWlhCRI70uShLRiOey3T%2Fuploads%2FNGo3aI0bJbI5aiaxiC3O%2Fimage.png?alt=media&#x26;token=57ca488f-80ac-4be5-84fc-38fe8c8a2d88" 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="https://3651122009-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmWlhCRI70uShLRiOey3T%2Fuploads%2Fwwsbla8WWkwDMOerwant%2Fimage.png?alt=media&#x26;token=de35e9d4-4b22-43d3-ad21-aecf5faefa61" 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="https://3651122009-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmWlhCRI70uShLRiOey3T%2Fuploads%2Ft4NrSaox5umi2XKQr6uv%2Fimage.png?alt=media&#x26;token=9d748092-77ba-4b30-a325-dc644d87c46d" 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="https://3651122009-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmWlhCRI70uShLRiOey3T%2Fuploads%2FCWI5cErNp3NRPB4rNvaa%2Fimage.png?alt=media&#x26;token=bdaa648d-13e4-4032-a727-4baf75290c20" 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="https://3651122009-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmWlhCRI70uShLRiOey3T%2Fuploads%2FKir2cdAMDEQdfBhHoMeY%2Fimage.png?alt=media&#x26;token=3d830ad4-5599-4786-910b-1e2e8f1f1389" 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="https://3651122009-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmWlhCRI70uShLRiOey3T%2Fuploads%2Fw1UK9d1se7me6b0kCKdH%2Fimage.png?alt=media&#x26;token=d184c38a-565f-4f8c-8c3c-92011158cdea" 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="https://3651122009-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmWlhCRI70uShLRiOey3T%2Fuploads%2FAMxlxBIIVVW97C4GAtzV%2Fimage.png?alt=media&#x26;token=e38e011e-3271-4b84-a47b-f1e37908cdf9" alt="" width="524"><figcaption><p>IK pass.</p></figcaption></figure>

<figure><img src="https://3651122009-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmWlhCRI70uShLRiOey3T%2Fuploads%2FGo9YyPxponov5NI7JjCo%2Fimage.png?alt=media&#x26;token=dc7bee46-946a-4cc7-abe9-72bbf8c12fd7" 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).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kinemation.gitbook.io/pras-documentation/tutorials/getting-set-up.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
