Table of contents

  1. Advanced Sight Component
    1. Functions
      1. Enable
      2. Disable
      3. Is Enabled
      4. Get Sight Data
      5. Override Sight Data
      6. Get Eye Point Of View Transform
      7. Get Body Actor
      8. Is Target Perceived
      9. Is Target Spotted
      10. Is Target Remembered
      11. Get State For Target
      12. Get Gain Value For Target
      13. Get Highest Gain Value
      14. Get Perceived Targets
      15. Get Spotted Targets
      16. Get Remembered Targets
      17. Is Any Target Perceived
      18. Is Any Target Spotted
      19. Is Any Target Remembered
      20. Force Forget Target
      21. Force Forget All Targets
    2. Events
      1. On Target Spotted
      2. On Target Perceived
      3. On Target Lost
      4. On Target Forgotten
    3. Properties
      1. Sight Data
      2. Eye Socket Name
      3. Use Only Yaw From Eye Socket
      4. Should Start Enabled
  2. Advanced Sight Data
    1. Properties
      1. SightInfos
      2. GainSightDuration
      3. AutoSuccessDistance
      4. LoseSightRadius
      5. DetectionByAffilation

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 the Target Actor
  • Spotted – when agent sees Target Actor but doesn’t perceive it yet
  • Perceived – when agent currently perceives Target Actor
  • Lost – when agent doesn’t sees Target 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 perceived
  • bWasRemembered – this flag determines whether previous state of the perceived actor was spotted or remembered. 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 lost
  • bWasPerceived – this flag determines whether previous state of the lost actor was perceived or spotted. 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.