Garry's Mod Wiki

Revision Difference

render.DrawLine#546513

<function name="DrawLine" parent="render" type="libraryfunc"> <description> Draws a line in 3D space. <rendercontext hook="false" type="3D"></rendercontext> </description> <realm>Client</realm> <args> <arg name="startPos" type="Vector">Line start position in world coordinates.</arg> <arg name="endPos" type="Vector">Line end position in world coordinates.</arg> <arg name="color" type="table" default="Color( 255, 255, 255 )">The color to be used. Uses the <page>Color</page>.</arg> <arg name="writeZ" type="boolean" default="false">Whether or not to consider the Z buffer. If false, the line will be drawn over everything currently drawn, if true, the line will be drawn with depth considered, as if it were a regular object in 3D space. <bug issue="1086">Enabling this option will cause the line to ignore the color's alpha.</bug></arg> </args> </function> ⤶ <example>⤶ <code>⤶ hook.Add("PostDrawTranslucentRenderables", "MySuper3DRenderingHook", function()⤶ render.DrawLine(LocalPlayer():EyePos(), LocalPlayer():EyePos() + LocalPlayer():EyeAngles():Forward() * 100, Color(255, 0, 0)) -- A Simple Line of code drawing a line starting for the eyes of the player and going forward.⤶ end)⤶ </code>⤶ ⤶ </example>