Usage Guide {{ currentPage ? currentPage.title : "" }}

This guide explains how to use the Advanced Targeting System once it is set up. It is divided into sections for key tasks, ensuring developers can quickly understand how to interact with the system.

Toggling Lock-On

1. Press the key bound to the `ToggleLockOn` action (e.g., “T”).

2. If a valid target is found (based on distance, camera proximity, and line-of-sight), the system locks onto it, and the pawn’s controller rotates to face the target.

3. Press the key again to disable lock-on.

Switching Targets

1. While locked on, press the key bound to `SwitchTargetRight` (e.g., “E”) to switch to the closest target to the right.

2. Press the key bound to `SwitchTargetLeft` (e.g., “Q”) to switch to the closest target to the left.

3. The system evaluates nearby targets and updates the lock-on to the new target, triggering the `On Target Selected` event.

Customizing Targeting Behavior

1. Open `BP_TargetingComponent` in the pawn’s Blueprint.

2. Adjust properties in the Details panel:

- `Targeting Distance`: Set the maximum distance for valid targets.

- `Rotation Interp Speed`: Control how quickly the pawn rotates to face the target.

- `Targeting Object Types`: Add or remove object types to filter valid targets.

- `bAutoSelectNextTarget`: Enable to automatically select a new target if the current one becomes invalid.

3. Save and test the changes in-game.

Adding Custom Targeting Widgets

1. Create a new Widget Blueprint (e.g., `WBP_CustomLockOn`) in the Content Browser.

2. Design the widget (e.g., add a custom image or text for the lock-on indicator).

3. In the targetable actor’s Blueprint, set the Widget Component’s Widget Class to `WBP_CustomLockOn`.

4. Ensure the `On Target Selected` function updates the Widget Component’s visibility as needed.

Notes:

- Always implement `Can Be Targeted` to prevent targeting invalid actors (e.g., dead enemies), as this improves performance and reliability.

- Use `bAutoSelectNextTarget` for seamless combat flow, but disable it for scenarios where manual target selection is preferred.

- Test targeting in crowded scenes to ensure the system prioritizes the correct target (closest to camera center).

- If extending the system, consider adding events in `BP_TargetingComponent` to notify other systems (e.g., animation or AI) when a target is selected.

{{{ content }}}