LineOfSightVector(vector, vector)

From NWN Lexicon
Revision as of 22:11, 23 August 2020 by Jasperre (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Returns whether there's a direct line between two positions.

int LineOfSightVector(
    vector vSource,
    vector vTarget


Source position
Target position


Returns whether or not there is a direct line of sight between the two vectors. (Not blocked by any geometry).

This function must be run on a valid object in the area it will not work on the module or area.

PLEASE NOTE: This is an expensive function and may degrade performance if used frequently.


Vectors are location markers - being a set of 3 co-ordinates (X, Y, Z), and so this can be used instead of LineOfSightObject() if the 2 objects just had their vector got by GetPosition(). Note that the Z position should be ground height + 1.0 if you wish to fully mimic LineOfSightObject.

The note about "run on a valid object in the area" is akin to it running GetArea(OBJECT_SELF) on the calling script. Why there isn't a parameter for an area to be passed in is anyones guess.



See Also



 author: Lilac Soul, editor: Jasperre