Table of contents
- Advanced Sight Component
- Functions
Enable
Disable
Is Enabled
Get Sight Data
Override Sight Data
Get Eye Point Of View Transform
Get Body Actor
Is Target Perceived
Is Target Spotted
Is Target Remembered
Get State For Target
Get Gain Value For Target
Get Highest Gain Value
Get Perceived Targets
Get Spotted Targets
Get Remembered Targets
Is Any Target Perceived
Is Any Target Spotted
Is Any Target Remembered
Force Forget Target
Force Forget All Targets
- Events
- Properties
- Functions
- Advanced Sight Data
This API reference page is documenting only blueprint callable functions and blueprint exposed properties. To learn about other systems that are not exposed to the blueprint user please refer to header files of the system.
Advanced Sight Component
Functions
Enable
Registers this agent to the sight system.
Disable
Unregisters this agent from the sight system.
Is Enabled
Returns boolean value defining whether this agent is currently registered or not to the sight system.
Get Sight Data
Returns currently assigned Sight Data
asset.
Override Sight Data
Overrides current value of Sight Data
property. Using this function ensures that previous config is unregistered in the sight system and the new one is registered properly.
Get Eye Point Of View Transform
Returns transform struct that is used by the system to define agent’s eye point of view. This is either default possessed pawn’s transform or transform of the socket when Eye Socket Name
property is defined.
Get Body Actor
Returns pawn possessed by the owning controller.
Is Target Perceived
Params:
Target Actor
– any actor based class
Returns true if actor passed as parameter to this function is currently perceived by the agent.
Is Target Spotted
Params:
Target Actor
– any actor based class
Returns true if actor passed as parameter to this function is currently spotted by the agent.
Is Target Remembered
Params:
Target Actor
– any actor based class
Returns true if actor passed as parameter to this function is currently remembered by the agent.
Get State For Target
Params:
Target Actor
– any actor based class
Returns one of the following possible states for actor passed as parameter:
Not Perceived
– when agent doesn’t know anything about theTarget Actor
Spotted
– when agent seesTarget Actor
but doesn’t perceive it yetPerceived
– when agent currently perceivesTarget Actor
Lost
– when agent doesn’t seesTarget Actor
but still remembers it
Get Gain Value For Target
Params:
Target Actor
– any actor based class
Returns float
value equal to current gain value for Target Actor
passed as parameter. The returned gain value will be in range of <0, GainSightDuration
>. If GainSightDuration
is greater than 0
, the returned value will NOT be normalized.
Get Highest Gain Value
This function is useful in case more than one target is spotted by the agent or none at all. The function searches through all queries and returns the highest value. Note that this function considers all targets, including these that are not perceived.. Reason for searching through all targets instead just spotted or perceived ones is because target that was spotted for some time reaches certain gain value but can be lost at any point and will be considered as not perceived. However the gain value will be approaching 0 every tick. Until it does reach 0 user might want to use the gain value to show to agent’s awarness or alert state lowering.
Get Perceived Targets
Returns array of all perceived targets by owning controller.
Get Spotted Targets
Returns array of all spotted targets by owning controller.
Get Remembered Targets
Returns array of all remembered targets by owning controller.
Is Any Target Perceived
Returns true
if any target is perceived; false
otherwise.
Is Any Target Spotted
Returns true
if any target is spotted; false
otherwise.
Is Any Target Remembered
Returns true
if any target is remembered; false
otherwise.
Force Forget Target
Params:
Target Actor
– any actor based class that we want this agent to forget
Immediately forgets actor that has been passed as a parameter. All appropriate events like On Target Lost
or On Target Forgotten
will be called.
Force Forget All Targets
Same as Force Forget Target
except calling this is going to cause all targets to be forgotten.
Events
On Target Spotted
Params:
Target Actor
– actor that has been spotted Broadcasted whenever not previously visible target becomes visible.
On Target Perceived
Params:
Target Actor
– actor that has been perceivedbWasRemembered
– this flag determines whether previous state of the perceived actor wasspotted
orremembered
. User can build their own logic based on that. Broadcasted when a target was spotted and was visible for long enough to become perceived. It is also called whenever a target has been lost but not yet forgotten, and while lost becomes visible. It then instantly becomes perceived again.
On Target Lost
Params:
Target Actor
– actor that has been lostbWasPerceived
– this flag determines whether previous state of the lost actor wasperceived
orspotted
. Broadcasted whenever a target was visible during previous sight check and is not visible in the current. Can be broadcasted when target is either spotted or already perceived.
On Target Forgotten
Params:
Target Actor
– actor that has been forgotten Broadcasted when a target was perceived, became lost and was not visible for long enough.
Properties
Sight Data
Data asset defining all necessary properties for the system. This can be either set in the default class properties or overriden using Override Sight Data
function in runtime.
Eye Socket Name
Name of the bone or socket defined on a possessed pawn mesh. This works both on skeletal and static meshes. If None
this functionality will be disabled.
Use Only Yaw From Eye Socket
If Eye Socket Name
is defined this settings becomes relevant. Defines whether system should use socket’s transform directly or should it only fetch yaw.
Should Start Enabled
Determines whether the agent should automatically register to the system at begin play or whether user wants to enable the agent manually.
Advanced Sight Data
Properties
SightInfos
An array of each sight range definition. Must contain at least one definition. There is no upper limit.
GainSightDuration
Defines how long a target must be visible in order to become perceived. Please note that gain value can be modified by GainMultiplier
from sight info definition.
AutoSuccessDistance
Defines how far from last know location a target must move away in order to be considered no longer visible. This is very useful to ensure that agents are not losing sight immediately after a target hides behind the corner.
LoseSightRadius
Defines how far away a target must be from agent’s current position to be considered no longer visible.
DetectionByAffilation
Defines whether this agent should only be looking for enemies, allies, neutral or any combination of them.