Recipes
Each of these takes a few nodes in the actor’s Event Graph.
Move a prop while the player isn’t looking
Section titled “Move a prop while the player isn’t looking”On Gaze Ended → Get HorrorGazeSubsystem → Find Hidden Random Offset (X and Y range -300..300, Z 0..0) → Branch on the result → Set Actor Location.
The result is a chair that is never where you left it and is never seen moving.
Make something creep closer each time
Section titled “Make something creep closer each time”Use the same wiring, but bias the offset ranges toward the player. Compute the direction from the actor to the player pawn and set the ranges so candidates land along it.
Play a sting only the first time it’s seen
Section titled “Play a sting only the first time it’s seen”On First Gaze Started → play the sting. It fires once per tracker, so you don’t need your own bookkeeping. Reset Gaze State arms it again.
React when the player stares too long
Section titled “React when the player stares too long”On Gaze Started → start a looping timer that reads Current Visible Duration. After two seconds of staring, the mannequin turns its head. Clear the timer in On Gaze Ended.
CurrentVisibleDuration is already zero inside OnGazeEnded, so read it from the timer, not from the end event.
Trigger something on the third look
Section titled “Trigger something on the third look”On Gaze Returned → read Seen Count → Branch on == 3 → the door slams.
Only teleport when the destination is unobserved
Section titled “Only teleport when the destination is unobserved”Before any teleport or expensive change, check the destination with Is World Location Hidden From Player (Simple). Pass the moving actor as Ignore Actor so its own mesh doesn’t block the traces.
Detect proximity instead of gaze
Section titled “Detect proximity instead of gaze”Untick Use View Angle. The tracker then reports “in range and not behind a wall” wherever the camera points, which works like a cheap trigger volume that respects walls.
Pause gaze during a cutscene, menu or dialogue
Section titled “Pause gaze during a cutscene, menu or dialogue”On cutscene start: Get HorrorGazeSubsystem → Set Global Gaze Enabled (false). On cutscene end: Set Global Gaze Enabled (true).
No tracker fires during the cutscene, and none fires a phantom OnGazeEnded when it starts. Set Game Paused alone isn’t enough, because the timers run on application time.
To pause one actor instead, call Set Tracking Enabled (false) on its component.
Check whether the player saw a death
Section titled “Check whether the player saw a death”In the death handler, call Is Instantly Visible To Player. True means the player saw the kill; false means you can move the body before they turn around.
Track a creature’s head, not its particle trail
Section titled “Track a creature’s head, not its particle trail”Set Sample Source to Mesh Sockets and Sample Mesh Component Name to CharacterMesh0 (on ACharacter). List the head, spine_03 and pelvis sockets, or whatever your skeleton calls them, in Sample Socket Names.
Give one actor two trackers
Section titled “Give one actor two trackers”Add two components with different settings, for example a sockets tracker on the face and a bounds tracker on the body, and bind different events on each. Each component registers on its own.
Set it up from C++
Section titled “Set it up from C++”Add "HorrorGazeTracker" to your module’s PublicDependencyModuleNames, then:
#include "HorrorGazeTrackerComponent.h"
UCLASS()class AMyHauntedProp : public AActor{ GENERATED_BODY()
public: AMyHauntedProp();
protected: virtual void BeginPlay() override;
UFUNCTION() void HandleGazeEnded(UHorrorGazeTrackerComponent* Tracker);
UPROPERTY(VisibleAnywhere) TObjectPtr<UHorrorGazeTrackerComponent> GazeTracker;};#include "MyHauntedProp.h"#include "HorrorGazeSubsystem.h"
AMyHauntedProp::AMyHauntedProp(){ GazeTracker = CreateDefaultSubobject<UHorrorGazeTrackerComponent>(TEXT("GazeTracker")); GazeTracker->MaxTrackDistance = 1500.f; GazeTracker->ViewAngleDegrees = 25.f;}
void AMyHauntedProp::BeginPlay(){ Super::BeginPlay(); GazeTracker->OnGazeEnded.AddDynamic(this, &AMyHauntedProp::HandleGazeEnded);}
void AMyHauntedProp::HandleGazeEnded(UHorrorGazeTrackerComponent* Tracker){ UHorrorGazeSubsystem* Gaze = GetWorld()->GetSubsystem<UHorrorGazeSubsystem>(); if (!Gaze) { return; }
FVector NewLocation; const bool bFound = Gaze->FindHiddenRandomOffset( this, FVector2D(-300.f, 300.f), // X range FVector2D(-300.f, 300.f), // Y range FVector2D(0.f, 0.f), // Z range /*MaxAttempts=*/ 12, /*ConservativeViewHalfAngleDeg=*/ 60.f, NewLocation);
if (bFound) { SetActorLocation(NewLocation); }}The delegates are dynamic multicast, so handlers must be UFUNCTION() and bound with AddDynamic. Configuration properties are public members: set them in the constructor, in BeginPlay or at runtime.