> 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/utilities/lock-on-target.md).

# Lock On Target

## Overview

The Lock on Target Component uses a GameObject Runtime Set to Find the closest gameObject on the Set.

These are used by the Lock On Target component to Lock on a Target.

![](/files/x7cAFGOK8bBXESs6UXzN)

## How to Use it

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

Once you have your Animal Set with the Aim and/or Look At Component set.

* Find the Prefab Lock On Target on the Project Window and add it to your character. You can set it as child gameobject of your character.

![](/files/F7cBmMp6y4P5T5ZKUkXL)

This prefab includes the Lock On Component already set. It also has a Trigger Proxy with an Sphere Trigger to collect all possible Targets the character may encounter.&#x20;

Set your Layers on your Trigger Proxy and the Tags you are going to use for finding possible lock on targets

![](/files/PBiQtdZlIVqRNoYNbzyB)

* On your scene add also the Cinemachine virtual camera \<CM Lock On Target>

![](/files/ac5g5H3awDIf4Yq4sVxg)

* Create the Input to connect the Lock On Target to the middle mouse button click. In AC 1.3.1+ you can create the Input automatically on the Input Context Menu.

## Parameters

### Aim

Reference for the Aiming Component. This is required

### Targets

Reference for the Runtime Game Object set where all the possible Lock On Targets will be stored.

## Events

### On Target Changed

Is Invoked when a new Target is assigned to Lock On. This will send the transform chosen to the Camera Event and it will also stored in a Transform Hook.

### **On Locking Target**

Is Invoked when the Lock On feature changes on and off. Useful if you want to activate the Strafe Mode on the Animal Controller.
