> For the complete documentation index, see [llms.txt](https://malbersanimations.gitbook.io/animal-controller/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://malbersanimations.gitbook.io/animal-controller/main-components/mode-aligner2.md).

# Mode Aligner2

***

## Overview

Mode Aligner is used to align the character to a target while executing a mode. Usually, to make the Attack animation to Look At the target is going to attack.&#x20;

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

{% hint style="danger" %}
If you are using the old version Mode Align, please upgrade to the new **Mode Aligner 2**
{% endhint %}

<figure><img src="/files/7u7YDdsqi1eViGE4IrHb" alt=""><figcaption></figcaption></figure>

***

## How it works

This component subscribes to the **MAnimal** component's \[OnMode Start] event, and listens every time a mode is played. Then it searches the "Align Targets" **Runtime Object Set** for possible near targets, using the *Search distance*. If one of the **aligners** on the list uses the **mode** that the **animal** is playing and it fulfills all the conditions, then the character will be aligned towards the target found.&#x20;

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

***

## Requirements

* An **Animal Controller** component. It does not have to be in the same gameobject as the Animal script. I recommend setting this component in a Child GameObject.&#x20;

<figure><img src="/files/9qPgFRYOVj5IWZH0RyFR" alt=""><figcaption></figcaption></figure>

* Requires a **RuntimeGameObject** set that will be used for storing all the possible alignment targets.&#x20;

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

* The possible targets need to be on the set. This is achieved by adding the **AddRuntimeSet** component to the targets.

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

* Possible targets should also have an **AITarget** component. This will be used to extract the **target's radius** to achieve a better alignment.

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

***

## Parameters

### General

#### Animal

Reference for the Owner of the Mode aligner

#### Set

Current aligner targets. ⚠️Possible aligner targets must have the **AddRuntimeObject** component.

#### Self Radius&#x20;

Radius of the owner to reposition when Use Radius is active. This radius prevents the animal from getting inside another target. &#x20;

#### Search Distance

Distance to compare which is the closest possible target to align. If none of the targets are within this radius, then the Alignment will be ignored

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

***

### Aligner Data

Every aligner data is a set you can do for each mode and/or abilities

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

#### Active

Enable or disable the Aligner Set. Disabled aligners will be ignored

#### Name

Name or description for the Aligner Set

#### Mode

Mode that the Aligner will listen to

#### Specific Abilities

What abilities to include or exclude? If the list is left empty, then the aligner will be active when the mode plays

#### Include/Exclude

Include or exclude toggle for the ability list

#### Conditions

Extra conditions to check to activate the aligner

#### Align Time

How long will the alignment last

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

#### Delay

Delay value to wait to activate the alignment. Use it for abilities that have anticipation.

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

#### Angle Offset

Offset rotation to apply to the alignment. Use the Offset for abilities that need the character to be in a certain angle. E.g. a execution from the back requires the character to turn 180 degree.

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

#### Align Curve

Curve value to apply to the alignment

#### Use Radius

When true, the aligner will move the animal closer to the target. Using the **AI Target Radius** values to position correctly, or the **SelfRadius** if there's no **AI Target** found.

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

#### Ignore Close

It will not move the character backwards if it is too close to the target.

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