Targeting Handler
Categories:
The GS_TargetingHandlerComponent is the central processor for the targeting system. It receives target registrations from sensory fields, maintains categorized lists of detected targets, and selects the best interact target based on proximity and type. It also manages cursor feedback and interaction range tracking.
For usage guides and setup examples, see The Basics: GS_Interaction.
The Targeting Handler sits on the same entity as the unit it serves (typically the player or an AI character). Sensory fields register and unregister targets as they enter and exit detection volumes. The handler evaluates all registered targets each tick to determine the closest interactable, which becomes the active interact target.
Contents
How It Works
Target Selection
Each tick, the handler runs ProcessClosestInteractable to evaluate all registered targets. It filters by type, checks interaction range, and selects the closest valid target. The result is broadcast via OnUpdateInteractTarget.
Interaction Range
A separate interaction range field provides a close-proximity subset of targets. Targets within this range are prioritized for interact selection. The range is driven by a dedicated GS_TargetingInteractionFieldComponent trigger volume.
Cursor Tracking
The handler updates the cursor position to follow the active interact target. Cursor visuals change based on target type (interact, item, unit, etc.).
API Reference
GS_TargetingHandlerRequestBus
Bus policy: ById, Multiple
| Method | Parameters | Returns | Description |
|---|---|---|---|
RegisterTarget | AZ::EntityId entity | bool | Registers a target entity detected by a sensory field. |
UnregisterTarget | AZ::EntityId entity | bool | Removes a target entity from the detection list. |
RegisterInteractionRangeTarget | AZ::EntityId entity | bool | Registers a target within the close interaction range. |
UnregisterInteractionRangeTarget | AZ::EntityId entity | bool | Removes a target from the interaction range list. |
GetInteractTarget | — | AZ::EntityId | Returns the current best interact target. |
GS_TargetingHandlerNotificationBus
Bus policy: ById, Multiple
| Event | Parameters | Description |
|---|---|---|
OnUpdateInteractTarget | AZ::EntityId target | Fired when the active interact target changes. |
OnEnterStandby | — | Fired when the system enters standby mode. |
OnExitStandby | — | Fired when the system exits standby mode. |
Virtual Methods
| Method | Parameters | Returns | Description |
|---|---|---|---|
CheckForTick | — | void | Called each tick to evaluate whether target processing should run. |
ProcessClosestInteractable | — | void | Determines the closest interactable target and sets it as the active interact target. |
GS_CursorComponent
Manages cursor display and positioning for targeting feedback.
GS_CursorRequestBus
Bus policy: Single, Multiple
| Method | Parameters | Returns | Description |
|---|---|---|---|
RegisterCursorCanvas | AZ::EntityId canvas | void | Registers the UI canvas for cursor rendering. |
HideCursor | bool hide | void | Shows or hides the cursor. |
SetCursorOffset | AZ::Vector2 offset | void | Sets the screen-space offset for cursor positioning. |
SetCursorVisuals | visual data | void | Configures cursor appearance. |
SetCursorPosition | AZ::Vector2 pos | void | Sets the cursor screen position directly. |
GS_CursorCanvasComponent
UI canvas layer that renders the cursor sprite.
GS_CursorCanvasRequestBus
Bus policy: ById, Multiple
| Method | Parameters | Returns | Description |
|---|---|---|---|
HideSprite | bool hide | void | Shows or hides the cursor sprite element. |
SetCursorSprite | sprite data | void | Sets the cursor sprite image. |
Extension Guide
The Targeting Handler is designed for extension via companion components. Add custom targeting logic by creating components that listen to GS_TargetingHandlerNotificationBus on the same entity. Override ProcessClosestInteractable for custom target selection algorithms.
Script Canvas Examples
Getting the current interact target:

Reacting to interact target changes:

See Also
For conceptual overviews and usage guides:
For component references:
Get GS_Interaction
GS_Interaction — Explore this gem on the product page and add it to your project.