Garry's Mod Wiki

Revision Difference

debugoverlay.Axis#567660

<function name="Axis" parent="debugoverlay" type="libraryfunc"> <description> Displays an axis indicator at the specified position. <note>This function will silently fail if the `developer` <page>ConVar</page> is set to `0`. It is not networked to clients, except for the <page text="listen server host">Player:IsListenServerHost</page>. It will not work when the game is paused.</note> </description> <realm>Shared</realm> <args> <arg name="origin" type="Vector">Position origin.</arg> <arg name="ang" type="Angle">Angle of the axis.</arg> <arg name="size" type="number">Size of the axis.</arg> <arg name="lifetime" type="number" default="1">Number of seconds to appear.</arg> <arg name="ignoreZ" type="boolean" default="false">If true, will draw on top of everything; ignoring the Z buffer.</arg> </args> </function> <example> <description> Render the axis at the map origin, unrotated (`Angle(0, 0, 0)`). The colored crosses shows the direction the axis lines are pointing too. Note that the green line is pointing in the opposite direction than it should be. The colors represent the direction it is pointing to: * **Red:** Points to `ang:Forward()` * **Green:** Points to `-ang:Right()`, "left" or "negative right" * **Blue:** Points to `ang:Up()` </description> <code> local pos = Vector(0, 0, 0) local ang = Angle(0, 0, 0) local len = 30 ⤶ debugoverlay.Axis(pos, ang, 10, 1, true)⤶ debugoverlay.Cross(pos + ang:Forward() * len, 10, 1, Color(255, 0, 0), true) -- Red⤶ debugoverlay.Cross(pos + ang:Right() * len, 10, 1, Color(0, 255, 0), true) -- Green⤶ debugoverlay.Cross(pos + ang:Up() * len, 10, 1, Color(0, 0, 255), true) -- Blue⤶ local lifetime = 5⤶ local size = 10⤶ ⤶ debugoverlay.Axis(pos, ang, size, lifetime, true)⤶ debugoverlay.Cross(pos + ang:Forward() * len, size, lifetime, Color(255, 0, 0), true) -- Red⤶ debugoverlay.Cross(pos + ang:Right() * len, size, lifetime, Color(0, 255, 0), true) -- Green⤶ debugoverlay.Cross(pos + ang:Up() * len, size, lifetime, Color(0, 0, 255), true) -- Blue⤶ </code> <output> <upload src="1b0c8/8de8c197fb76949.png" size="580497" name="debugoverlay_axis_colors.png" /> </output> </example>