> 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/ai/ai-animal-control.md).

# AI Animal Control

## Overview

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

This component is the bridge between the Animal Controller with the Unity  Navmesh system.&#x20;

The Animal uses the function `Move(Vector3 Direction)` to move around.&#x20;

This component moves the animal by using a target *Position* or *Transform*. It gets the Direction of the Navmesh Agent's desired Velocity and feeds it into the Animal controller.

It is a basic way to move the animal around in an environment, using all the rules of a Navmesh like jumping, falling from a cliff or staying on the Navmesh. It can also interact automatically with Zones.

## Requirements

* The component needs a Navmesh Agent.

![](/files/-MYqE5T0VBaR17R0IEvk)

* Since the animals have the Pivot of the Root Gameobject on the center of the back feet; it is better to have all the AI Components in a Child Object and move it to the front feet of the Animal.

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

<figure><img src="/files/6geXPXDcWspfhRXQdfAO" alt=""><figcaption></figcaption></figure>

## Parameters \[General]

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

### Targets

### Target

The Transform reference used to calculate the direction to move.

### Next Target

Reference of the Next Target stored, (given by the target) when the animal arrives at the current target.

### AI Parameters

### Update Agent

How often the path for the agent should be recalculated - lower numbers mean less performance.

### Stopping Distance

Default stopping distance the Animal will use to arrive at a Target. **Waypoints** and **AI Targets** will have their own stopping distance value.&#x20;

{% hint style="info" %}
You can add the **AI Target** component to any other Object to override this default value.
{% endhint %}

### Slowing Distance

Distance to start slowing the animal before arriving at the destination

### Look at Offset

Distance from the Animals root to apply the LookAt Target logic when the animal arrives to a target

### Point Stop Distance

Stop Distance used on the SetDestination method. This is commonly used on the Point Click component.

### Slowing Limit

Limit for the Slowing Multiplier to be applied to the Speed Multiplier

### Wait Time Multiplier

Multiplier used for Waypoints Wait time. Set it to 0 if you want to ignore waiting on waypoints.

### Disable Input

If **true** then it disables the input component on the animal. This will avoid the AI and Player Input to fight over controlling the Character

## References

### Animal

Reference for the Animal Component

### Agent

Reference for the Nav Mesh Agent

### Stop Agent On

Allows you to determine specific **states** to Stop the Agent working on. E.g. if you have a Fall state here, then it stops the agent working on the fall state.

## Events

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

### On Enabled

Invoked when the AI Control is enabled

### On Disabled

Invoked when the AI Control is disabled

### On Position Arrived(Vector3)

Invoked when the Animal arrives at a Target Position. E.g. When the Animal is set to a position with the Click Point Component.

### On Target Arrived(Transform)

Invoked when the Animal arrives at a Target Transform

### On New Target Set(Transform)

Invoked when is Assigned a new Target.

## Debug

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

When the Editor is Playing all internal variables are shown. This is perfect for debugging the AI main Parameters.

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

### Console

Print to the console all the Notifications of the Animal AI Control.

### In-Game Log

Shows in the scene on top of each AI animal the main values while using the component

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

### Gizmos

Shows on the Scene all the gizmos of the Animal AI Control
