#unreal

Part of AI Perception System

The sight sense uses overlaps and linetraces to check “sight” between two actors. By default, it uses a regular linetrace to the origin point of the other actor, but this can be customized using IAISightTargetInterface.

The default Trace Channel is Visibility, but you can change this from Project Settings under AI System. Search for “Default Sight Collision Channel”.

Configuration

See also: Configuring AIPerception Senses in C++

Turning off Pawn autoregistration

The engine registers all pawns as sight stimuli sources by default. This can be turned off by adding the following into DefaultGame.ini:

[/Script/AIModule.AISense_Sight]
bAutoRegisterAllPawnsAsSources=false

If you turn it off, you need to add an AIPerceptionStimuliSource component into the pawn for it to register.

Note: If you change this setting, you may need to restart the editor for it to take effect.

See also: Manually registering AI Perception stimuli sources

Performance

Sight sense performs a linetrace into every perceivable actors within the sight radius, from every actor using perception. If you have a lot of actors perceiving each other, implementing Perception Detection by Affiliation can provide significant performance improvements.

Timeslicing

The sight sense is time sliced. This reduces its impact on performance if you have a lot of controllers using it. This can also cause latency to sight perception events, but only if you have so many controllers that you hit the time slice limits.

The timeslicing behavior is configurable via DefaultGame.ini. See AISense_Sight.h for which values are configurable.

See also