Look Target¶
What the character looks at. Setting it is how a character looks at anything, and both gaze engines take it the same way.
The Source¶
Implement ILookTargetSource and assign it to the brain's LookTargetSource.
| Member | What it returns |
|---|---|
Transform CurrentTarget |
Where the character should be looking, or null for nothing |
bool CurrentTargetVisible |
Whether the target can currently be seen. Defaults to true |
FaceCue polls it. A source that follows the player, the nearest speaker, or whatever your own attention system decides is the steady answer, and an override sits on top of it for the exceptions.
Setting an Override¶
brain.SetLookTarget(target); // anonymous lane
brain.SetLookTarget(this, target); // as this owner
| Method | Does |
|---|---|
SetLookTarget(Transform) |
Claims the anonymous lane |
SetLookTarget(object owner, Transform) |
Claims the lane as this owner |
ReleaseLookTargetOverride() |
Gives back the anonymous lane |
TryReleaseLookTargetOverride(object owner) |
Gives it back only if this owner still holds it |
ForceClearLookTargetOverride() |
Takes it back regardless |
Pass null as the target to override the source with nothing, which is how you make a character stop looking at something its source keeps offering.
Asking About It¶
| Member | Tells you |
|---|---|
CurrentLookTarget |
What the character is looking at, override or source |
CurrentLookTargetVisible |
Whether that target is visible |
IsLookTargetOverridePresent |
Whether an override is masking the source |
IsLookTargetOverrideOwner(object owner) |
Whether this owner holds it |
LookTargetOverrideOwner |
Who holds it |
LookTargetOverrideOwnerKind |
None, Anonymous or Explicit |
Tracking¶
Two members on this lane are about whether looking is permitted, not where.
GazeTargetTrackingEnabled is the permission. Turn it off and the character stops following its target without forgetting what the target is, which is what you want for a cutscene that has taken the head.
IsActivelyTracking reports whether a target is currently acquired. A target closer than the minimum distance still counts as acquired: the minimum-distance rule changes how the target is followed, not whether it is being tracked.
Events¶
LookTargetOverrideChanged fires when the override changes, with a LookTargetOverrideChange carrying:
| Field | Holds |
|---|---|
Transition |
Which kind of change. See Sources and Overrides |
HadPreviousOverride |
Whether an override was present before |
PreviousTarget |
The target that was being overridden to |
PreviousOwnerKind |
Who held it before |
GazeTargetTrackingEnabledChanged fires when tracking permission changes, with the previous value and then the current one. Writing the value it already holds publishes nothing, and source polling never raises it, so it reports deliberate permission changes only.
Identity, Not Equality
This lane compares targets by reference identity, not by Unity's equality. Under Unity's overloaded equality any destroyed object equals any other destroyed object, which would silently stop one destroyed target from replacing another and leave the stale one standing. Reference identity is what lets a replacement always take.
Where It Reaches¶
Straight into Gaze, whichever engine is running. How the character gets there, how much of the body joins in, and what happens to a target it cannot comfortably reach are all on that page.