util.PixelVisible
From GMod Wiki
Function | |
Syntax |
util.PixelVisible( Vector Position, Number Radius, pixelvis_handle_t Pixel Visible Handle ) Where is this used? |
Description: | |
Returns the Float of visibility of the pixels in the radius of the Vector position. | |
Returns: | Float |
Part of Library: | Util |
Realm: | |
BBCode Link: | [b][url=http://wiki.garrysmod.com/?title=Util.PixelVisible]Util.PixelVisible [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] |
Examples
Additional Notes
You need to create a new pixel visibility handle for each unique query. Using the same pixel visibility handle for more than one pixel visibility query in the same engine tick will yield unusual results as demonstrated by the following client side Lua script.
local PixVis = util.GetPixelVisibleHandle() local pts = {} for i = 1,10 do table.insert( pts, Vector( 0, i * 64, 0 ) ) end local function hudpaint_showvisibility() local v, p for i = 1,10 do v = util.PixelVisible( pts[i], 16, PixVis ) p = pts[i]:ToScreen() if p.visible then draw.SimpleTextOutlined(string.format( "%.01f", v ), "Default", p.x, p.y, color_white, 1, nil, 1, color_black) end end end hook.Add( "HUDPaint", "showvisibility", hudpaint_showvisibility )