Reference
UHorrorGazeTrackerComponent
Section titled “UHorrorGazeTrackerComponent”The component you add to any actor you want to track. Blueprint name Horror Gaze Tracker, component group Horror. It never ticks on its own (PrimaryComponentTick.bCanEverTick = false); the subsystem drives it. All configuration properties are BlueprintReadWrite, and changes take effect on the next frame.
Detection — Gaze | Detection
Section titled “Detection — Gaze | Detection”| Property | Type | Default | Description |
|---|---|---|---|
MaxTrackDistance |
float (cm) |
2000 |
Beyond this distance the tracker reports not visible, whatever the view cone says. The cheapest reject. Minimum 10. |
bUseViewAngle |
bool |
true |
Whether the view-cone test is part of visibility. Off = distance and line of sight only (proximity awareness). |
ViewAngleDegrees |
float |
30 |
Half-angle of the “looking at me” cone from camera forward; 30 = a 60° cone. Range 1–89. Ignored when bUseViewAngle is off. |
TraceChannel |
ECollisionChannel |
Visibility |
Channel for the occlusion traces. |
bIgnoreLocalPlayerPawn |
bool |
true |
Ignores the local player’s pawn in traces. Leave on: the camera sits inside or next to the pawn capsule, and without this every trace hits the player’s own pawn. |
AdditionalIgnoredActors |
TArray<TSoftObjectPtr<AActor>> |
empty | Actors that never count as occluders: companions, the player’s vehicle, attached weapons. |
PollingHz |
float |
15 |
How often visibility is re-evaluated. Range 1–120. |
Gating — Gaze | Gating
Section titled “Gating — Gaze | Gating”| Property | Type | Default | Description |
|---|---|---|---|
MinDwellTimeSeconds |
float |
0.15 |
How long the actor must stay raw-visible before it counts as seen. Raise it if quick pans trigger the mechanic. |
MinAwayTimeSeconds |
float |
0.3 |
How long the actor must stay raw-hidden before it counts as unseen. Raise it if props passing in front cause false look-aways. |
Samples — Gaze | Samples
Section titled “Samples — Gaze | Samples”| Property | Type | Default | Description |
|---|---|---|---|
SampleSource |
enum | Actor Bounds | Where the traces aim: Actor Bounds, Named Component Bounds or Mesh Sockets. See Sampling modes. |
SampleComponentName |
FName |
none | Named Component Bounds only: the primitive component whose bounds to use. |
SampleMeshComponentName |
FName |
none | Mesh Sockets only: the mesh component that owns the sockets. |
SampleSocketNames |
TArray<FName> |
empty | Mesh Sockets only: the sockets to trace to. |
SampleBoundsCorners |
bool |
true |
Bounds sources only: also trace to the 8 box corners (9 traces). Off = centre only. |
Debug — Gaze | Debug
Section titled “Debug — Gaze | Debug”| Property | Type | Default | Description |
|---|---|---|---|
bDebugDraw |
bool |
false |
Draws sample points, traces and the camera forward axis on each evaluation: green = raw visible, red = occluded, cyan = camera forward. Also unlocks per-evaluation logging with HorrorGaze.Log 1. Editor and non-shipping builds only. |
DebugDrawLifetime |
float (s) |
0.1 |
How long each debug draw persists. Set slightly above 1 / PollingHz to avoid flicker. |
Control and state
Section titled “Control and state”| Property | Access | Description |
|---|---|---|
| Tracking Enabled | edit / read | Master switch for this tracker. Untick it to start disabled; change it at runtime with Set Tracking Enabled. |
IsCurrentlyVisible |
read-only | True while in the VISIBLE state (after dwell gating). |
bHasBeenSeenBefore |
read-only | True once the actor has entered VISIBLE at least once. |
SeenCount |
read-only | Number of transitions into VISIBLE. |
CurrentVisibleDuration |
read-only | Seconds in the current VISIBLE state. Already zero inside OnGazeEnded, so sample it while visible if you need the stare length. |
Events — Gaze | Events
Section titled “Events — Gaze | Events”All four are DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam with one payload: the UHorrorGazeTrackerComponent* that fired. Get its actor with Get Owner.
| Event | When it fires | Typical use |
|---|---|---|
OnFirstGazeStarted |
The very first transition into VISIBLE. | One-time sting, tutorial hint, “the player has now seen it”. |
OnGazeReturned |
The 2nd and every later transition into VISIBLE. | React to the look-back: sound, counter, reveal. Not for making the change. |
OnGazeStarted |
Every transition into VISIBLE. | The canonical “visible now” signal. |
OnGazeEnded |
Every transition out of VISIBLE. | Where you change the world. |
On entering VISIBLE, the broadcast order is fixed: OnFirstGazeStarted or OnGazeReturned first, then OnGazeStarted. Treat OnGazeStarted as the signal that always fires and the other two as qualifiers.
Functions — Gaze
Section titled “Functions — Gaze”ResetGazeState()
Section titled “ResetGazeState()”Resets the state machine to NEVER SEEN: clears SeenCount, bHasBeenSeenBefore, timers and accumulators. Broadcasts OnGazeEnded only if the actor was visible. The next sighting fires OnFirstGazeStarted again. Use it on respawn or a scripted reset.
IsInstantlyVisibleToPlayer() → bool
Section titled “IsInstantlyVisibleToPlayer() → bool”Synchronous one-shot check. It ignores the dwell/away timers and the polling interval and runs the full evaluation now, against the viewpoint the subsystem cached on its last tick. Returns false when no camera is available. Example: “did the player see me die?”
SetTrackingEnabled(bool NewEnabled, bool ResetStateOnDisable = false)
Section titled “SetTrackingEnabled(bool NewEnabled, bool ResetStateOnDisable = false)”Pauses or resumes this tracker. While it is disabled nothing runs: no evaluation, no timer advancement, no events. SeenCount, bHasBeenSeenBefore and IsCurrentlyVisible stay frozen. Pausing while visible does not fire OnGazeEnded, because a gameplay pause is not the player looking away. On re-enable, evaluation resumes from the frozen state with normal gating. Pass ResetStateOnDisable = true when the pause is a narrative end: it calls ResetGazeState() too.
IsTrackingEnabled() → bool
Section titled “IsTrackingEnabled() → bool”Returns the per-tracker switch.
UHorrorGazeSubsystem
Section titled “UHorrorGazeSubsystem”The UWorldSubsystem that drives every tracker in a world. In Blueprint use the Get HorrorGazeSubsystem node; in C++, GetWorld()->GetSubsystem<UHorrorGazeSubsystem>().
Global control — Gaze | Control
Section titled “Global control — Gaze | Control”SetGlobalGazeEnabled(bool)
Section titled “SetGlobalGazeEnabled(bool)”Pauses or resumes every tracker in this world without touching their own Tracking Enabled flags. When off, the driver returns before doing any work: no evaluations, no timers, no events. Components stay registered, so re-enabling resumes them at once. Use it for cutscenes, dialogue, inventory and pause menus. Each world starts in the state set by Gaze Tracking Enabled in Project Settings.
IsGlobalGazeEnabled() → bool
Section titled “IsGlobalGazeEnabled() → bool”Returns the runtime flag. The HorrorGaze.Enabled console variable can override it.
Location queries — Gaze | Visibility
Section titled “Location queries — Gaze | Visibility”IsWorldLocationHiddenFromPlayer(WorldLocation, ConservativeViewHalfAngleDeg, SampleRadius, TraceChannel, IgnoreActors) → bool
Section titled “IsWorldLocationHiddenFromPlayer(WorldLocation, ConservativeViewHalfAngleDeg, SampleRadius, TraceChannel, IgnoreActors) → bool”Full-control variant. True when the player can’t see the location. Takes an array of actors to ignore. Algorithm in Hidden-location queries.
IsWorldLocationHiddenFromPlayer (Simple) → bool
Section titled “IsWorldLocationHiddenFromPlayer (Simple) → bool”The same test with one optional actor to ignore and usable defaults on every pin:
| Pin | Default |
|---|---|
WorldLocation |
— |
IgnoreActor |
none |
ConservativeViewHalfAngleDeg |
60 |
SampleRadius |
30 |
TraceChannel |
Visibility |
FindHiddenRandomOffset(ActorToHide, OffsetXRange, OffsetYRange, OffsetZRange, MaxAttempts, ConservativeViewHalfAngleDeg, OutWorldLocation) → bool
Section titled “FindHiddenRandomOffset(ActorToHide, OffsetXRange, OffsetYRange, OffsetZRange, MaxAttempts, ConservativeViewHalfAngleDeg, OutWorldLocation) → bool”Tries random offsets within the three FVector2D (min, max) ranges around the actor’s location and returns the first candidate the player can’t see, in OutWorldLocation. The actor is ignored automatically. Uses a 30 cm sample radius on Visibility. After MaxAttempts failures it returns false and leaves OutWorldLocation at the actor’s current location.
C++ only
Section titled “C++ only”| Function | Description |
|---|---|
bool GetCachedViewpoint(FVector& OutLocation, FRotator& OutRotation) const |
The camera pose from the last driver tick. False when no PlayerCameraManager is available yet. |
void RegisterTracker(UHorrorGazeTrackerComponent*) / UnregisterTracker(…) |
Called by components in BeginPlay / EndPlay. Idempotent; you normally never call them. |
Project Settings
Section titled “Project Settings”Project Settings → Game → Horror Gaze Tracker (UHorrorGazeSettings, saved to DefaultGame.ini).
| Setting | Default | Effect |
|---|---|---|
| Gaze Tracking Enabled | true |
Master switch; every world starts in this state. Change per world at runtime with SetGlobalGazeEnabled. |
| Debug Draw All Trackers | false |
Debug draw for every tracker at once, without touching each component’s flag. Editor and non-shipping builds only. |
Console variables
Section titled “Console variables”| Variable | Values | Effect |
|---|---|---|
HorrorGaze.Enabled |
-1 (default), 0, 1 |
QA override of the master switch. 0 forces tracking off, 1 forces it on, overriding Project Settings and SetGlobalGazeEnabled. -1 hands control back. |
HorrorGaze.Log |
0 (default), 1 |
Per-evaluation logging: distance, angle from camera forward, sample count, clear samples, first blocking actor. Logs every tracker with debug draw on, plus the first 10 evaluations of every tracker, so a freshly placed actor reports its own setup. |
Log categories
Section titled “Log categories”LogHorrorGazeTracker: component level. State transitions (GAZE STARTED,GAZE ENDED) and enable/disable always log at Log. Raw visibility flips log at Verbose (Log LogHorrorGazeTracker Verbose).LogHorrorGaze: subsystem level. Initialisation, tracker registration, global enable/disable.