Links
🎯

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.

How to Use it

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.
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.
Set your Layers on your Trigger Proxy and the Tags you are going to use for finding possible lock on targets
  • On your scene add also the Cinemachine virtual camera <CM Lock On Target>
  • 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.