> 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/point-click.md).

# Point Click

The Point Click component allows for AI animals to move with point-click movement - similar to what you would find in a MOBA or a Top Down RPG - you click, the events fire.

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

It's not just limited to that though, you can be creative and use the events for other purposes too unrelated to movement!

## Requirements

* It needs an AI Control component and an AI agent already attached to the character.

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

* A Unity Event System needs to be on the scene. This will send all the click events to the script.

<figure><img src="/files/23dSJKwGewgOwMYClLGQ" alt=""><figcaption></figcaption></figure>

* Every clickable surface that the animal can walk, needs to have an event Trigger Event with a Pointer Click with the next setting:

<figure><img src="/files/EVGwzripkq8zT49i3Hvy" alt=""><figcaption><p>Point Click is a Sriptable Object that connects the surfaces with the Point Click component</p></figcaption></figure>

* Zones and Interactables components do not need the Event trigger - Pointer Click

## How to Set it Up

In the same AI Control gameobject, add it by searching for Point Click, or by going to Add Component -> Malbers -> AI -> Point Click

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

This automatically connects all the events and parameters to the AI Control component.

## Parameters

### Point Click Data

Scriptable Object used to record all the Events from the Event trigger - Pointer Click in every clickable surface and this component.&#x20;

<figure><img src="/files/WnAThFEimoTKCB6iNJhz" alt=""><figcaption><p>location of the scriptable object</p></figcaption></figure>

### **Point UI**

Prefab used to display where the point click was made

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

### Button

What button of the mouse is used. (Left, Right, or Middle Mouse)

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

### Radius

Radius to find a possible target nearby when clicking on an empty surface. Possible targets can be a Zone, Interactable, or another animal.&#x20;

### Clear Target

When the animal has a target already assigned, it will clear the current target on the AI control component if the next click is on an empty surface.

## Events

<figure><img src="/files/4J8GNJP1PmguPCMg8JM8" alt=""><figcaption></figcaption></figure>

### On Point Click

Invoked when a click on a walkable surface is registered.&#x20;

### On AI Target Click

Invoked when a click on a possible target is registered. (Zone, Interactable, other characters)
