HasDirectLOS - ObjectReference

Member of: ObjectReference Script

Checks to see if this reference has line-of-sight to the target object.

SyntaxEdit

bool Function HasDirectLOS(ObjectReference akTarget, string asSourceNode = "", string asTargetNode = "") native

ParametersEdit

  • akTarget: The object to check line-of-sight to.
  • asSourceNode: The node to cast the line of sight check from. If empty, will cast from the root of the object.
    • Default: ""
  • asTargetNode: The node to cast the line of sight check to. If empty, will cast to the root of the object.
    • Default: ""

Return ValueEdit

True if this reference has line-of-sight to the object.

ExamplesEdit

; Can the spotlight "see" bob?
if (SpotlightRef.HasDirectLOS(Bob_Alias.GetReference()))
  Debug.Trace("The spotlight can see Bob")
endIf


; Can the spotlight "see" bob's head?
if (SpotlightRef.HasDirectLOS(Bob_Alias.GetReference(), asTargetNode = "Head"))
  Debug.Trace("The spotlight can see Bob's head")
endIf

NotesEdit

  • Most of the time you actually want to use HasDetectionLOS on Actor instead as that takes other things into account and may perform a better pick.

See AlsoEdit