Garry's Mod Wiki

render.DrawWireframeBox

  render.DrawWireframeBox( Vector position, Angle angle, Vector mins, Vector maxs, Color color = Color( 255, 255, 255 ), boolean writeZ = false )

Description

Draws a wireframe box (outlines) in 3D space.

For a function that draws a filled box, see render.DrawBox.

This is a rendering function that requires a 3d rendering context.

This means that it will only work in 3d Rendering Hooks.

Arguments

1 Vector position
Position of the box.
2 Angle angle
Angles of the box.
3 Vector mins
The lowest corner of the box.
4 Vector maxs
The highest corner of the box.
5 Color color = Color( 255, 255, 255 )
The color of the box.
6 boolean writeZ = false
Sets whenever to write to the zBuffer.

Example

Draws a white outlined box at the position you are looking at. Uses the normal DrawBox function for the fill color, and wireframe box function to give the filled box some contrast and shape.

local boxSize = Vector( 10, 10, 10 ) local boxColor = Color( 255, 255, 255, 100 ) local outlineColor = Color( 255, 255, 255, 255 ) hook.Add( "PostDrawTranslucentRenderables", "BoxxieWithOutline", function() local pos = LocalPlayer():GetEyeTrace().HitPos -- position to render box at render.DrawWireframeBox( pos, angle_zero, -boxSize, boxSize, outlineColor, true ) render.SetColorMaterial() -- material for coloring render.DrawBox( pos, angle_zero, -boxSize, boxSize, boxColor ) end )
Output: What the example does:

image.png

For reference, the wireframe box alone:

image.png