Skip to main content

Visibility Detection Activity

Detect players inside an NPC's field of view

Fields

FieldTypeDefaultDescription
radiusVar<Double>10.0The radius of vision
fovVar<Double>90.0Field of View in degrees (up to 360)
shapeVar<VisionShape>CONEThe shape of the vision detectionValues:CONESPHERE
showDisplayVar<Boolean>falseShow debug display (Client-side optimized)
Common TypeWriter fields (triggers, criteria)
FieldTypeDefaultDescription
triggersList<Ref<TriggerableEntry>>empty—
criteriaList<Criteria>empty—

How to use it​

Add this activity to an NPC instance. The NPC looks for players in a CONE (the fov angle, up to 360 degrees, in front of it) or a SPHERE of radius blocks, and a player is detected only if no block is in the way. Once per sighting, triggers run for that player (if their criteria match) and the matching Player Visibility Detection events fire. The player must leave the field of view before they can be detected again.

This activity does not move or rotate the NPC. The activities of the same family (look close, spin, patrol, random patrol, bobbing, path, target location, look at block, look at pitch/yaw, random look) add a movement or rotation to the same detection. showDisplay draws the field of view with flame particles for debugging.