# Aligner

## Overview

Align the position and rotation of a Target Object to a gameObject with this component. Usually, this component is used by the Zones to align the Animal that uses it.

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

## Limitations

This only works when the animal is grounded.

## How to use it

Let's take the Chest Sample on the Demo scene: ***1 - PlayGround Human (1 - Holsters)*** as an example. In this scene, when you approach the central chest, Steve will be aligned (Re-position and oriented\_ so it plays the animation in the right direction/position:

<figure><img src="/files/li3jiw8HODfiMT5bvVt8" alt="" width="505"><figcaption></figcaption></figure>

To use it, you need to call the function: **`Aligner.Align(Transform TargetToAlign).`**&#x20;

In the chest example. Whenever an Animal enters the Zone, it will tell the aligner to align the entering character to the correct position.&#x20;

<figure><img src="/files/LxBG0ugX3nAv0uQG9f80" alt="" width="531"><figcaption><p>When its used make sure you connect the Aling() method to the Dynamic option</p></figcaption></figure>

## Parameters

### Position

Align the Target to the Position of the Main Point.&#x20;

<figure><img src="/files/nUslJdwCnC3OqW0XepLu" alt=""><figcaption><p>The character will move to the Align point Position</p></figcaption></figure>

If the Second Point is set, then it will align the Target to the closest point on the line made from both points.

<div align="center"><figure><img src="/files/xE7itg1igFvvc7tNhTgC" alt="" width="285"><figcaption><p>Alinging  closer to the left point</p></figcaption></figure> <figure><img src="/files/YTmXOuiWTgHkgkpwCPt2" alt="" width="296"><figcaption><p>Alinging closer to the right point</p></figcaption></figure></div>

### Rotation

Orient the target to the rotation of the Main Point.

<figure><img src="/files/Tlmn35xF97n8PWivNwqA" alt=""><figcaption><p>The character rotates using the Main Point Rotation</p></figcaption></figure>

### Look At

Orient the Target to look at the Main Point Position.

<figure><img src="/files/UvqdoXAXLv3yYoK1YCkz" alt="" width="563"><figcaption><p>The character looks at the Aligner (but it does not reposition because the Radius is zero)</p></figcaption></figure>

### Radius (Look At)

If the Radius is greater than zero, then the Target will be positioned also to the closest position on the radius created from the look-at.

<figure><img src="/files/2h3Otx5IzIjAi7dV32bi" alt="" width="563"><figcaption></figcaption></figure>

### Double Sided (Position - Rotation)

Allows the Target to align correctly to a Double Side Position and rotate correctly to the rotation of the aligner. This is useful when you want 2 different positions and rotations, when facing an aligner in a 180 direction.

<figure><img src="/files/yEVZ4KxesMsJP9uXxrl9" alt="" width="465"><figcaption></figcaption></figure>

### Main Point

Main Transform to use as Position, Rotation and Look At values to make the Aligment

### Second Point

Extra Transform to use as Position, Rotation.

### Align Time

The time needed to make the alignment

### Align Curve

Interpolation to make the alignment.

### Angle Offset (Rotation - LookAt)

Adds a Rotation offset to the Rotation or Look At alignment.


---

# 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://malbersanimations.gitbook.io/animal-controller/utilities/aligner.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.
