# General HAP Integration

### **General Integration with a custom Character Controller (Riding only)**

{% embed url="<https://streamable.com/nf3gwl>" %}

If you have your own Character Controller or some 3rd Party Controller from the store you will need to do the following steps:

1. Add the [**MRider** ](https://malbersanimations.gitbook.io/animal-controller/riding/mrider)component to your character.

![](https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FP9Q1ap3lJofNiwZ5dyeK%2FnMqfrFj2Iq.gif?alt=media\&token=1ce936bb-35b6-465c-9bac-b83786c32540)

2\.  If you are using a CUSTOM **Input System** you need to connect **`MRider.MountAnimal()`** to your **Mount Input** and **`MRider.DismountAnimal()`** to your **Dismount Input**.&#x20;

{% hint style="success" %}
If you want to continue using my[ **Malbers Input**](https://malbersanimations.gitbook.io/animal-controller/main-components/malbers-input) then use the Context Menu **Create Mount Inputs**.
{% endhint %}

![](https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FgtKGgCICIEJXkaXrEbcc%2FUnity_ftGpjojLxy.png?alt=media\&token=c02bee68-7f4f-4cf3-9527-f29a4e33b34e)

This will connect the Inputs automatically with the correct methods.

![](https://lh6.googleusercontent.com/8aNw5_KHNM96mPKO4s6pbkHaxF9CRhcjQdNUZjzXfEGTgpVwlpN4mhRjSJBPBGq216h8bpNX3HGA_NbEefnRvzxf4WWXSyJJar3meM2-bIChnyNSgHe_ZY0ZVeIhxwoYHfaCcWB6)

![](https://lh3.googleusercontent.com/C8fy0NxWhSAhvrA60LuP5jIV-bKj4NW7oTlSBf_T8BRdSHr37lhpR4CbS7l2gWBsKJaqma_h2nS-m6W962UdvQ1cNH6SVLmXSnyZkZqQyuyq-FpdEaSFjmPSI-QHjZdnVr0n295o)

3\. If you are using the Riding for mobile then you need to Set the [**Event Listeners**](https://malbersanimations.gitbook.io/animal-controller/scriptable-architecture/scriptables/mevent-listener).. This **Events** are used on the Mobile UI and Mobile Input to communicate with the Rider in a non dependent way. Do this with the Context menu **Create Event Listeners** .

![](https://lh6.googleusercontent.com/WAzqmr-tzBS4EAkzKViUAfcVZjuWjekF3I3vwtfzck7BrmtxHqsHMw_MlEbG35h0raFtUrLwZLS5BdZMdzGISool8oGbp1SL-VCD6nnoTnGHP3GZeQjoQc5xcbmUeuKlYUsjSeSs)

{% hint style="info" %}
This will automatically add the [**MEvent Listene**](https://malbersanimations.gitbook.io/animal-controller/scriptable-architecture/scriptables/mevent-listener)r component with the [**Events** ](https://malbersanimations.gitbook.io/animal-controller/scriptable-architecture/scriptables/mevents)needed for the Rider to communicate with external scripts.
{% endhint %}

![](https://lh4.googleusercontent.com/cfvaOfror9fr4AbNKFT99JlkDD3PlPzPL1zrSaZLKh9NfZH8iyUkpcdB1jIKhUg55zT1LJNINKL1SDPoWnW_RU3c4O_Dc61q-97Y0SKhINv-rN4w8Ya7pimlTRiFZVlOH2ME7kIV)

## Mount UI

To show the "Press Key to Mount" UI you need to add the Mount UI prefab to any canvas you have on your scene

![](https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FQjK8AR1VXPoKGHj7xTUG%2FD1PXN4U3n4.gif?alt=media\&token=12135325-0481-4207-b613-3bc14985cf0b)

## Mounted Layer

{% hint style="warning" %}
**IMPORTANT:**

Is highly recommended to duplicate your Character Animator First before adding the *Mounted Layer.*
{% endhint %}

4\. Click Add mounted Layer. This will add an extra layer called Mounted and the parameters that the script needs to control the Animator when the character is riding.

{% hint style="danger" %}
The Rider Script must be at the same level as the **Animator Component.** Otherwise, the **Add Mount Layer Button** will not appear.
{% endhint %}

![](https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2Fe6f2DrbJ1ErlPwlb5MU4%2Fimage.png?alt=media\&token=bf6be1d9-32ae-490f-ba1f-7f4f55e61172)

{% embed url="<https://streamable.com/32rfti>" %}
Mounted and Rider Combat Layers
{% endembed %}

## Disabling components

5\. On **Disable Components** add the **scripts/components** that interfere with the logic while Riding. (Usually is used for scripts that are not supposed to be active/working while the character is Riding. E.g: scripts that move and rotate the character while is on foot, ragdoll, components that you need to be disabled while riding, etc. Also are used to disable Inputs that are only supposed to be active when the character is not riding: E.g: a Crouch Input).

![](https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FCJcQCjraoRr2MaRxv6JL%2Fimage.png?alt=media\&token=77fe6bce-ebf8-4e09-b473-ed05ea1856f6)

### Custom Link Script

6\. Sometimes you will need to disable functions, change variables values when you are Riding the Animal. The best way to solve this is by creating a new Script to communicate between your controller and the Rider Script. You can take full advantage of the **Rider Events** to let know your character Controller to activate or deactivate behaviours while the character is **Mounting** or **Dismounting** the animal. (Ex: Disabling the Crouch Logic of your controller when the rider starts the **mount** animations; and enabling it back when the character finishes the **dismount** animations).

![](https://963537199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lzhr1XSMzMqNXjRnNlb%2F-Lzs6l4sC1bG4Royz_W0%2F-Lzs8AX9jpwWu57pCeQ1%2Fimage.png?alt=media\&token=73455724-5f2a-4910-8412-f800d57ad389)

\
**And that should be it!.** :grin:&#x20;
