Garry's Mod Wiki

Revision Difference

GM:CalcView#511420

<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&#x27;s view position.</arg>⤶ <arg name="angles" type="Angle">The player&#x27;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>CamData</page></ret>⤶ </rets>⤶ </function>⤶ ⤶ <example>⤶ <description>Draws the LocalPlayer and sets the view behind.</description>⤶ <code>⤶ local function MyCalcView(ply, pos, angles, fov)⤶ local view = {}⤶ view.origin = pos-(angles:Forward()*100)⤶ view.angles = angles⤶ view.fov = fov⤶ view.drawviewer = true⤶ ⤶ return view⤶ end⤶ ⤶ hook.Add( "CalcView", "MyCalcView", MyCalcView )⤶ </code>⤶ ⤶ </example>