Garry's Mod Wiki


  table GM:CalcView( Player ply, Vector origin, Angle angles, number fov, number znear, number zfar )


Allows override of the default view.


1 Player ply
The local player.
2 Vector origin
The player's view position.
3 Angle angles
The player's view angles.
4 number fov
Field of view.
5 number znear
Distance to near clipping plane.
6 number zfar
Distance to far clipping plane.


1 table
View data table. See CamData structure


Draws the LocalPlayer and sets the view behind.

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 )