HomeSystem plugins › AFS_UX_Gaze
System

AFS_UX_Gaze

Dwell-based interaction: look at an object for a configurable time to trigger it, with a filling indicator.

What it gives you

  • Hands-free interaction for headsets without controllers
  • A configurable dwell time per object
  • Circular and linear indicator styles
  • An accessibility path on every platform

Requires

AFM_Abilities AFM_AutoDestroy AFS_Libraries

Required by

AFE_Showroom AF_Examples

7 assets19 API members

Description

Gaze interaction exists for two audiences: headsets without controllers, and users who cannot use controllers comfortably. It works on desktop and mobile too, where it becomes a look-and-wait interaction driven by the camera.

BPC_PawnAbility_Gaze traces from the camera each frame. BPC_Interaction_Gaze on the target declares a dwell time and an indicator widget, and fires Progress Finished once the player has held their gaze long enough. Interface_Gaze on the owning actor can veto.

The dwell timer is driven by the same tick-and-timeout pattern as highlighting, so looking away cancels it without any explicit event.

Setup

  1. Enable AFS_UX_Gaze.
  2. Add BPC_PawnAbility_Gaze to the pawn and set Gaze View Distance.
  3. Add BPC_Interaction_Gaze to the target, set Trigger Time and pick a Widget Progressbar.
  4. Bind to Progress Finished.

Usage

Tuning dwell

Trigger Time is the dwell duration. Under about 0.8 s users trigger things accidentally; over about 2.5 s it feels unresponsive.

Choosing an indicator

Widget_GazeIndicator_Circular reads well on small targets; Widget_GazeIndicator_Linear suits wide ones. Derive from Widget_GazeIndicator for your own.

Vetoing

Implement Interface_Gaze and return false from CanGazeView.

The dwell indicator part-filled on a gazed object
AFS_UX_Gaze_result.pngThe dwell indicator part-filled on a gazed object
The dwell indicator part-filled on a gazed object

Key properties

PropertyWhen to change
Gaze View DistanceHow far gaze reaches from the camera
Trigger TimeDwell duration per object
Widget ProgressbarIndicator style
Sound ProgressbarAudio feedback while dwelling

Extending

Derive from Widget_GazeIndicator and override SetProgress for a custom indicator.

Performance notes

Performance

The gaze ability raises its own tick interval when nothing is hovered, so idle gaze is cheap. Keep Gaze View Distance no longer than the scene needs.

Example map

Map_Examples_Gaze shows dwell interaction on several object types.

Troubleshooting

The indicator never appears. Widget Progressbar is empty, or the object's collision does not block the gaze trace.

API reference

Every blueprint asset in this plugin. Expand an asset to see its members.

Components

BPC_Interaction_Gaze7 members
extends BPC_Interaction · implements OutsidePawnRPCInterface
KindNameSignatureDescription
varWidget_ProgressbarProgressbarClass<Widget_GazeIndicator>Indicator widget shown while the player dwells on this object. Choose the circular or linear variant, or subclass for your own.
varTriggerTimeProgressbarfloatHow long the player must keep looking at this object before it triggers, in seconds.
varSound_ProgressbarSoundSoundBaseSound played while the dwell indicator fills.
fnCanGazeHighlight(HitComponent: PrimitiveComponent, SourceInfo: ST_SourceInfo, out CanHighlight: bool)Returns whether this object currently accepts gaze, consulting Interface Gaze on the owner if it is implemented.
fnCalculateLocationAndRotation(Pawn: Pawn, ref const Impact: Vector, out Location: Vector, out Rotation: Rotator)Works out where to place the dwell indicator and how to orient it towards the player.
eventTickHighlight(SourceInfo: ST_SourceInfo, TraceResult: HitResult)Keeps the gaze alive for this frame and advances the dwell timer. Triggers once Trigger Time is reached.
eventProgressFinished()Fires when the dwell completes. Bind to this to run the gaze action.
BPC_PawnAbility_Gaze1 members
extends BPC_PawnAbility
KindNameSignatureDescription
varGazeViewDistanceSettingsfloatHow far the gaze trace reaches from the camera.

Helper

BP_Helper_GazeIndicator7 members
extends Actor
KindNameSignatureDescription
varProgressBarClass<Widget_GazeIndicator>Widget class used to draw the dwell progress.
varOwningPlayerPlayerControllerPlayer controller this indicator belongs to, so it is only drawn for the gazing player.
varProgressSoundSoundBaseSound played while the indicator fills.
eventPlayProgressBar(Duration: float)Starts filling the indicator over the given duration.
eventSetPercent(NewProgress: float)Sets the indicator fill directly, for driving progress from outside.
eventStopProgressBar()Stops and resets the indicator when the player looks away.
eventHideAndDestroy()Fades the indicator out and destroys it.

Interfaces

Interface_Gaze1 members
extends Interface
KindNameSignatureDescription
fnCanGazeViewGazeView(GazeComp: BPC_Interaction_Gaze, SourceInfo: ST_SourceInfo, out CanHighlight: bool)Implement on an actor to veto or allow gaze under your own conditions. Returning false suppresses the gaze highlight and dwell.

Widgets

Widget_GazeIndicator1 members
extends UserWidget
KindNameSignatureDescription
eventSetProgress(Progress: float)Sets the indicator's fill from 0 to 1. Override in a subclass to draw progress differently.
Widget_GazeIndicator_Circular1 members
extends Widget_GazeIndicator
KindNameSignatureDescription
eventSetProgress(Progress: float)Drives a radial fill from the dwell progress.
Widget_GazeIndicator_Linear1 members
extends Widget_GazeIndicator
KindNameSignatureDescription
eventSetProgress(Progress: float)Drives a horizontal bar fill from the dwell progress.