IsLineOfSight
Whether nothing stands between two points.
true when a ray from the first point reaches the second without meeting the level’s geometry - a wall, a roof, a
tree, a closed door. Always true without the geometry. The server uses the same test on hit claims when
[validation] line_of_sight is on (a blow through a wall is refused).
Syntax
Section titled “Syntax”IsLineOfSight(x1, y1, z1, x2, y2, z2)| Parameter | Type | |
|---|---|---|
x1 |
number | metres |
y1 |
number | metres |
z1 |
number | metres |
x2 |
number | metres |
y2 |
number | metres |
z2 |
number | metres |
Returns
Section titled “Returns”true when the line is clear
Example
Section titled “Example”local ax, ay, az = GetPlayerPos(archer)local tx, ty, tz = GetPlayerPos(target)if not IsLineOfSight(ax, ay, az + 1.5, tx, ty, tz + 1.5) then SendClientMessage(archer, COLOUR_SERVER, "No shot from here.") endSee also
Section titled “See also”RayCast · HasCollision · the The world - clock, weather, terrain, the navmesh, the geometry group of the index
