Garry's Mod Wiki

GM:CalcView

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

Description

Allows override of the default view.

Arguments

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.

Returns

1 table
View data table. See CamData structure

Example

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 )