HasDirectLOS - ObjectReference

From Creation Kit
Jump to: navigation, search

Member of: ObjectReference Script

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

Syntax

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

Parameters

  • 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

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

Examples

; 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

  • 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