Garry's Mod Wiki

Revision Difference

GM:CalcView#553119

<function name="CalcView" parent="GM" type="hook"> <ishook>yes</ishook>⤶ <description>Allows override of the default view.</description> <realm>Client</realm> <predicted>No</predicted>⤶ <args> <arg name="ply" type="Player">The local player.</arg> <arg name="origin" type="Vector">The player's view position.</arg> <arg name="angles" type="Angle">The player's view angles.</arg> <arg name="fov" type="number">Field of view.</arg> <arg name="znear" type="number">Distance to near clipping plane.</arg> <arg name="zfar" type="number">Distance to far clipping plane.</arg> </args> <rets> <ret name="" type="table">View data table. See <page>Structures/CamData</page></ret> </rets> </function> <example> <description>Draws the LocalPlayer and sets the view behind.</description> <code> hook.Add( "CalcView", "MyCalcView", function( ply, pos, angles, fov ) local view = { origin = pos - ( angles:Forward() * 100 ), angles = angles, fov = fov, drawviewer = true } return view end ) </code> </example>