My spider senses are tingling!
An intelligent agent is more than a bunch of conditions and branching logic. It has to be aware of its surrounds, as well as know to to discern what is something that is important enough to catch its attention than from scene foliage.
The Behavior module comes with a Perception component that addresses this problem. This Perception component comes with different Perceptors (aka Senses) that the agent will store in its memory and keep track of them.
The most common perceptron. Sight allows an agent to know the location of another object and identify it.
- Field of View: Vision cone for the character. The human eye has a cone of 120 degrees, but can perceive movement a bit further.
- Vision Distance: Length where the horizon is drawn for the character.
- Sight Layer Mask: Which objects occlude other objects. Transparent objects should be added in a separate layer for a character to see through them.
(Visual representation of Field of View and Vision Distance)
There are two ways you can use the Perceptrons. One is through the use of a Trigger. The other one is using a Condition.
You can make a Trigger execute a list of Actions or Conditions detecting when an object becomes visible by the Perception component.
(Left: Trigger detecting when the Player is in seen. Right: Using the Sight Condition)