# How to use Cover System

The **Cover System** works very simply, it only needs two scripts, the **JU Cover Controller** which is added to the player character and the **Cover Trigger** which is added to a trigger close to a wall to create a cover area.

{% hint style="info" %}
At the moment the Cover System only works natively for the Player, but in the future I will adapt it for AIs
{% endhint %}

## First steps with Cover System

1. Add a **JU Cover Controller** to your player

<div align="left"><figure><img src="/files/SBhKwCUtulJCMv9i7jhX" alt="" width="233"><figcaption></figcaption></figure></div>

2. Create a Cover Trigger&#x20;

<div align="left"><figure><img src="/files/FPlD21vbWna8fVZwdWXM" alt=""><figcaption></figcaption></figure></div>

3. Play a little

<div align="left"><figure><img src="/files/gsq18agQ5LXXCAyHV2xm" alt=""><figcaption></figcaption></figure></div>

{% hint style="success" %}

## Tip

you can use [Prevent Gun Clipping Script](/ju-tps-documentation/game-development/how-to-create-weapons-and-items/prevent-gun-clipping-through-walls.md) to improve the cover experience preventing the weapon from clipping through walls.
{% endhint %}

## Configuring JU Cover Controller

The JU Cover Controller has several interesting parameters to better adapt to your game's style, It already works plug and play but you might like to change some parameters:

| Parameters                         | Description                                                                                                                                                                                                                  |
| ---------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Cover Trigger tag                  | Tag to detect Cover trigger box                                                                                                                                                                                              |
| Current Cover Trigger              | Cover trigger currently detected                                                                                                                                                                                             |
| Enable Cover                       | Enable Cover                                                                                                                                                                                                                 |
| Auto Mode                          | Causes the Cover System to start automatically without needing to press a button, based on movement and angle to the wall, when deactivated the Cover System will use the interaction button (F) to start                    |
| Sneak Speed                        | Movement speed in Cover                                                                                                                                                                                                      |
| Rotation Speed                     | Rotation speed to Cover                                                                                                                                                                                                      |
| Crouched Sneak Speed               | Crouched movement speed in Cover                                                                                                                                                                                             |
| Corner Position Offset             | It is the character's adjustment position on a corner when in Fire Mode                                                                                                                                                      |
| Wall Offset Position               | Distance of the wall(or the center of the Cover Trigger)                                                                                                                                                                     |
| Wall Offset Position in FireMode   | Distance of the wall(or the center of the Cover Trigger) when in Fire Mode, It is useful for a better position pointing a weapon                                                                                             |
| Cover Animator Parameter           | It is the name of the parameter in the Animator Controller                                                                                                                                                                   |
| Camera Right Offset                | Camera position ajustment on Right/Horizontal Axis when in Cover, this parameter works for right and left adjustment                                                                                                         |
| Switch Side Speed                  | Camera position adjustment transition speed                                                                                                                                                                                  |
| Spine Inclination                  | Spine bone lean when in Cover, this parameter works for right and left adjustment                                                                                                                                            |
| Left Weapon Inclination Intensity  | Left angle adjustment of the [Item Aim Rotation Pivot](/ju-tps-documentation/game-development/how-to-use-inventory-and-add-items/how-to-align-weapon-rotation.md#item-aim-rotation-center-align) when in Fire Mode and Cover |
| Right Weapon Inclination Intensity | Left angle adjustment of the Item Aim Rotation Pivot when in Fire Mode and Cover                                                                                                                                             |
| Lean Axis                          | 🔴 It is the spine inclination axis, the default is the front axis (0,0,1) but you may have to change the axis due to your character's rig, you can test and see which works best on your character                          |
| Fire Mode Duration In Cover        | Customized Fire Mode duration for the Cover System, it is useful if you want the character to cover faster so as not to take damage                                                                                          |
| On Cover / On Exit Cover           | These are events called in these situations, these events are useful if you want to call any methods                                                                                                                         |

## Cover Trigger

The **Cover Trigger** is actually a very simple script, it basically serves for the **JU Cover Controller** to receive essential information from the trigger in a practical way.

The **Cover Trigger** has only one variable, which is used to inform the **JU Cover Controller** that the cover is only possible by crouching.

There is already a function for creating Cover Triggers as you saw above, but if you want to create one manually, a Cover Trigger requires the settings marked in red below:

<figure><img src="/files/Fu2sJXaN1SlPHCHJVrRV" alt=""><figcaption></figcaption></figure>


---

# 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://julhiecio.gitbook.io/ju-tps-documentation/game-development/how-to-use-cover-system.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.
