HasDirectLOS - ObjectReference

From the Fallout4 CreationKit Wiki
Jump to navigation Jump to search

Member of: ObjectReference Script

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

Syntax[edit | edit source]

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

Parameters[edit | edit source]

  • 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 Value[edit | edit source]

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

Examples[edit | edit source]

; 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

Notes[edit | edit source]

  • 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 Also[edit | edit source]