AI Animal Control

Overview

This component is the bridge between the Animal Controller with the Unity Navmesh system.

The Animal uses the function Move(Vector3 Direction) to move around.

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.

  • 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.

Parameters [General]

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.

You can add the AI Target component to any other Object to override this default value.

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

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

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

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

Gizmos

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

Last updated