Garry's Mod Wiki

History for util.PixelVisible

Revision Difference

util.PixelVisible#527886

<function name="PixelVisible" parent="util" type="libraryfunc"> <description>Returns the visibility of a sphere in the world.</description> <realm>Client</realm> <args> <arg name="position" type="Vector">The center of the visibility test.</arg> <arg name="radius" type="number">The radius of the sphere to check for visibility.</arg> <arg name="PixVis" type="pixelvis handle t">The PixVis handle created with <page>util.GetPixelVisibleHandle</page>. <warning>Don't use the same handle twice per tick or it will give unpredictable results.</warning></arg> <warning>Don't use the same handle twice per tick or it will give unpredictable results.</warning> </arg> </args> <rets> <ret name="" type="number">Visibility, ranges from 0-1. 0 when none of the area is visible, 1 when all of it is visible.</ret> <ret name="" type="number">Visibility, ranges from `0-1`. `0` when none of the area is visible, `1` when all of it is visible.</ret> </rets> </function> <example> <description>Draws a box when the center of the map is visible on your screen.</description> <code> local PixVis function SetupPixVis() hook.Add( "Initialize", "SetupPixVis", function() PixVis = util.GetPixelVisibleHandle() end end ) hook.Add("Initialize", "SetupPixVis", SetupPixVis) function TestPixelVisibility() local visible = util.PixelVisible(Vector(0, 0, 0), 16, PixVis) hook.Add( "HUDPaint", "TestPixelVisibility", function() local visible = util.PixelVisible( Vector( 0, 0, 0 ), 16, PixVis ) if visible && visible != 0 then draw.RoundedBox( 10, 0, 0, 100, 100, Color(0, 0, 0, 200 * visible) ) if visible and visible ~= 0 then draw.RoundedBox( 10, 0, 0, 100, 100, Color( 0, 0, 0, 200 * visible ) ) end end end ) hook.Add("HUDPaint", "TestPixelVisibility", TestPixelVisibility) </code> </example></example>

Special Pages


Wikis

?

Render Time: 71ms

DB GetPage 46
Get RevNew 3
Get RevOld 13
Render Body 0
Render Sidebar 7