- Documentation
- Client functions
- isWorldPointVisible
Function
isWorldPointVisible
Checks whether a world point is on screen and not hidden by a building or terrain. Occlusion is checked in the background, so the result for a new point arrives after a moment. For 3D labels and markers that should not show through walls.
Syntax
bool isWorldPointVisible(float x, y, z)Arguments
x, y, zfloat- The point.
Returns
true when the point is visible.
Example
addEventHandler("onClientRender", root, function()
local x, y, z = 2495, -1687, 15
if isWorldPointVisible(x, y, z) then
local sx, sy = getScreenFromWorldPosition(x, y, z)
if sx then dxDrawText("Grove Street", sx, sy) end
end
end)
Notes
Occlusion in the background. You do not need processLineOfSight every frame; the game computes occlusion in the background.
See also
setWorldPointOcclusionTurns occlusion checks inisWorldPointVisibleon or off (false= points visible through walls, for debugging).getScreenFromWorldPositionTurns a world point into a screen point (pixels). Returnsfalsewhen the point is behind the camera or off screen. The third result is the distance from the camera. Useful for text above heads.