# Slide

## Overview <a href="#overview" id="overview"></a>

The Slide State allows the character to slide on a slippery surface. Its State [**ID** ](https://malbersanimations.gitbook.io/animal-controller/scriptable-architecture/scriptables/scriptable-ids#states-ids)is **9.**

It does not require RootMotion Animations. It only requires slide animations.

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2F5Yn839OChF3aoH8VjaE1%2FUnity_0I8JBZspw6.gif?alt=media&#x26;token=6d7ff504-d13a-4e4e-beab-f1f9693e6351" alt=""><figcaption></figcaption></figure>

## &#x20;How it works

The character will detect the ground underneath and it will search for a [**Ground Speed Changer**](../../speed-ground-changer) Component attached to the ground. If the [**Ground Change**](../../speed-ground-changer)r has enabled the Slide option. the State will be activated.

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FOYQORaGVUTVnPa27Pnzy%2Fimage.png?alt=media&#x26;token=3d844c25-d5ca-4fff-8cfc-aa63cb7a1e28" alt=""><figcaption></figcaption></figure>

## Creating the State <a href="#creating-the-state" id="creating-the-state"></a>

To create a new Slide, click the Plus\[+] button on the States list.

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2F4b43ehFcDzQ05uDcEgrb%2FUnity_wGnOQUM5hX.gif?alt=media&#x26;token=4832796a-e34e-44f0-b476-c244401c3749" alt="" width="477"><figcaption></figcaption></figure>

Or duplicate any of the already created Slide States Assets of any animal you own and drag it to the States List.

## Priority <a href="#priority" id="priority"></a>

The state should have a higher priority than [**Idle**](https://malbersanimations.gitbook.io/animal-controller/main-components/manimal-controller/states/idle), [**Locomotion,** ](https://malbersanimations.gitbook.io/animal-controller/main-components/manimal-controller/states/locomotion)and but below [**Fall** ](fall)since the animal can fall anytime if there's no more ground beneath it.

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FL6OEWzy4QgO4iks0BDRx%2Fimage.png?alt=media&#x26;token=fc72b44c-0134-4210-b702-8b7ad64a4f96" alt="" width="468"><figcaption></figcaption></figure>

When the animal is in this state, all the Lower priority states are ignored until the [**exit conditions**](https://malbersanimations.gitbook.io/animal-controller/main-components/manimal-controller/states/jump-basic#exit-condition) for this state are fulfilled, or a higher priority state has valid activation conditions.

## Requirements <a href="#requirements" id="requirements"></a>

The Slide state requires a ground with the[ **SpeedGround Changer** ](../../speed-ground-changer)component attached to work, with the Slide option set to **true**.&#x20;



It also requires a new set of sliding animations.

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FliGiFbBUEvrppE2Ltv3T%2Fimage.png?alt=media&#x26;token=3b3bfed8-2205-4c86-83f1-2e29622cbc07" alt=""><figcaption></figcaption></figure>

## Activation <a href="#activation" id="activation"></a>

This state is an automatic state, meaning it will be checked for the conditions given by the Ground Changer to be activated. If the Current Slope angle is greater than the Ground Changer Min Slope Angle then the state will be activated. See GroundChanger conditions for more details

The state can also be automatically activated if the Slope Option is enabled.

### By Input <a href="#input" id="input"></a>

The State **does not** need an input to be activated. Only a Ground Speed Changer component&#x20;

### By Zones <a href="#zones" id="zones"></a>

The State **does not** need a zone to be activated. Only a Ground Speed Changer component&#x20;

### Animal Reaction <a href="#animal-reaction" id="animal-reaction"></a>

Animal Reactions can be used to activate or force-activate the state. Check [**Reactions**](https://malbersanimations.gitbook.io/animal-controller/main-components/reactions)

### Public Method <a href="#public-method" id="public-method"></a>

To activate the Jump State via script call the method:

`Animal.State_Activate(9)` or `Animal.State_Activate(StateEnum.Slide)`

***

## &#x20;Exit Conditions

Through code, the exit conditions will be executed to check if the State can exit. In the case of this state, the **conditions** are:

* There's no more ground with a [**Ground Speed Changer**](../../speed-ground-changer) beneath the character
* A State with greater priority values is Activated
* The current Angle Slope of the terrain is lower than the Min Angle Slope of the Ground Speed Changer

## Speeds

How fast the Slide will be done is due to the Speed Set Modifiers.

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FVCjDFZ1SWNPkZYfPCtkR%2Fimage.png?alt=media&#x26;token=95d6e62b-94bc-48d9-9ed6-18515daec04c" alt="" width="439"><figcaption><p>The animal will go down on a slide slope with a 15 value of velocity</p></figcaption></figure>



## Animator <a href="#animator" id="animator"></a>

The Slidestate requires the Animation States in charge of the Slide Logic

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2Fs8yxQ4W023IWZlg0pxat%2Fimage.png?alt=media&#x26;token=31b3d977-d9a3-49a3-8e10-523b42d95d51" alt="" width="488"><figcaption><p>The Enter Transition Condition is State = 9 (ID)</p></figcaption></figure>

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2F0h9Itiweo4UWFqtkjhsd%2Fimage.png?alt=media&#x26;token=350f0907-f93d-45ec-bca5-9fffca56fc3f" alt="" width="479"><figcaption><p>Enter Transition and Conditions</p></figcaption></figure>

### Core Animation <a href="#core-animation" id="core-animation"></a>

All States have a core animation, on which the animal will stay while the state is active. In the case of Slide will be the Slide Animation State.

⚠️This core animation must be always tagged just like the Name of the State ID.

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FDMYLkfQmbBdKDkm2A53x%2Fimage.png?alt=media&#x26;token=e1ed6d47-6709-4b26-8c9d-94894ec222a3" alt="" width="563"><figcaption></figcaption></figure>

You can create a 1DBlend tree to have better animations for the sliding. Use the Horizontal value.

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FSQrVySWAcJbOGyjYChVs%2FUnity_IwOtB6EAfM.gif?alt=media&#x26;token=f9c27fb1-65df-4598-9544-cdd5710f4333" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
<mark style="color:green;">**The slide animations do not require to be rootmotion animations**</mark>
{% endhint %}

### Exit Transitions <a href="#exit-transitions" id="exit-transitions"></a>

&#x20;(Newer Version of AC does not require exit transitions on the States)

## Slide Parameters

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FuUA1zgLp0fjEtkp1uqHz%2Fimage.png?alt=media&#x26;token=2997b31d-bc26-4ff3-816c-351afa1c465a" alt="" width="452"><figcaption></figcaption></figure>

### Orient Lerp

Lerp value for the Alignment to the surface

### Min Slope Angle

If the current Slope of the character is greater than this value, the state can be activated.

If the current Slope of the character is lower than this value. The state will exit.

### Ignore Rotation

The rotation of the character while sliding will be ignored. This value is overridden by the Ground Slide Data. (This value will be used when AutoSlope is true)

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FJ3lKYqu5IJCtWBzsp3PW%2FUnity_rODpWTwXB2.gif?alt=media&#x26;token=8ee51961-22fc-4daf-8a1e-e4c14c0a49e4" alt=""><figcaption></figcaption></figure>

### Rotation Angle

When Sliding the Animal will be able to orient toward the direction of this given angle

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2F7SHVDGheMilBvjc9fsHo%2FUnity_D8pRndOn6o.gif?alt=media&#x26;token=2e775a03-55ac-4e5b-baaf-56c01529bae9" alt=""><figcaption><p>Value changes from 5 to 50</p></figcaption></figure>

### Side Movement

When Sliding the Animal will be able to move horizontally with this value. This value will be modified by the Ground Speed Changer Data.

### Exit Conditions (Speed)

If the Speed is lower than this value the Slide state will end, even when we are still on a Slide Ground

### Exit Conditions  (Angle Slope)

If the Slope of the Slide ground is greater than this value, the Slide State will exit. Even when we are still on a Slide Ground

### Exit Conditions (Wait time)

When a Flat terrain is reached. it will wait this time to transition to Locomotion or Idle.

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FxlKX3jLLicZ03Ny5Jgbz%2FUnity_EbEOsD7TqI.gif?alt=media&#x26;token=d41b6e09-9471-4db9-8cf0-b39664664a6b" alt=""><figcaption></figcaption></figure>

### Auto Slope (No Ground Changer)

Activate the Sliding state if the character is on a slope&#x20;

_(It allows to activate the state **without** the Speed Ground Changer Component)_

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FpEk87VlFxSNV2ZYN8Fxc%2FUnity_QPZfQtVWYO.gif?alt=media&#x26;token=7d398b79-83a3-4a7c-b9e9-a73005903bf4" alt=""><figcaption><p>The ground slopes activate the sliding</p></figcaption></figure>

### Enter Angle Slope

If the Slope of the Slide ground is greater than this value, the Slide State be Activated. Zero value will ignore Enter by Slope

### Facing Angle Slope

Enter the Slide state if the Character is facing the slope.. Default value 90









