Garry's Mod Wiki

Revision Difference

cam.Start3D#514092

<function name="Start3D" parent="cam" type="libraryfunc">⤶ <description>⤶ Sets up a new 3D rendering context. Must be finished by <page>cam.End3D</page>.⤶ ⤶ For more advanced settings such as an orthographic view, use <page>cam.Start</page> instead.⤶ ⤶ <rendercontext hook="false" type="3D"/>⤶ ⤶ <bug issue="1995">Negative x/y values won't work.</bug>⤶ ⤶ <bug issue="2682">This will not update current view properties.</bug>⤶ </description>⤶ <realm>Client</realm>⤶ <args>⤶ <arg name="pos" type="Vector" default="\u003Cpage\u003EGlobal.EyePos\u003C/page\u003E()">Render cam position.</arg>⤶ <arg name="angles" type="Angle" default="\u003Cpage\u003EGlobal.EyeAngles\u003C/page\u003E()">Render cam angles.</arg>⤶ <arg name="fov" type="number" default="nil">Field of view.</arg>⤶ <arg name="x" type="number" default="0">X coordinate of where to start the new view port.</arg>⤶ <arg name="y" type="number" default="0">Y coordinate of where to start the new view port.</arg>⤶ <arg name="w" type="number" default="\u003Cpage\u003EGlobal.ScrW\u003C/page\u003E()">Width of the new viewport.</arg>⤶ <arg name="h" type="number" default="\u003Cpage\u003EGlobal.ScrH\u003C/page\u003E()">Height of the new viewport.</arg>⤶ <arg name="zNear" type="number" default="nil">Distance to near clipping plane.</arg>⤶ <arg name="zFar" type="number" default="nil">Distance to far clipping plane.</arg>⤶ </args>⤶ </function>⤶ ⤶ <example>⤶ <description>Set up a 3D rendering environment in a 2D rendering hook to render models on HUD.</description>⤶ <code>⤶ hook.Add( "HUDPaint", "3d_camera_example", function()⤶ cam.Start3D()⤶ for id, ply in pairs( player.GetAll() ) do⤶ ply:DrawModel()⤶ end⤶ cam.End3D()⤶ end )⤶ </code>⤶ <output>All players can be seen through walls.</output>⤶ ⤶ </example>