> Agent-readable docs index: /llms.txt. Download /docs.zip to grep all markdown files locally.

---
title: View
icon: camera
---

# <ApiPageIcon icon="camera" />View

<ApiExposes data="[{&#x22;k&#x22;:&#x22;OBJECT&#x22;,&#x22;c&#x22;:&#x22;method&#x22;,&#x22;s&#x22;:&#x22;view.ViewContext&#x22;,&#x22;h&#x22;:&#x22;#viewviewcontext&#x22;},{&#x22;k&#x22;:&#x22;OBJECT&#x22;,&#x22;c&#x22;:&#x22;method&#x22;,&#x22;s&#x22;:&#x22;view.ViewmodelContext&#x22;,&#x22;h&#x22;:&#x22;#viewviewmodelcontext&#x22;}]" />

## view\.ViewContext<ApiTag label="object type" />

The camera of the current frame. It is passed to the `override_view` event. Read and change
`origin`, `angles` and `fov` inside that callback. Do not keep the object after the callback
returns.

Reading or writing a field that does not exist throws an error.

<ApiMembers>
  <ApiMember kind="prop" name="view.ViewContext.angles" summary="The view angles of the camera." ret="[[{&#x22;s&#x22;:&#x22;QAngle&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/angle#qangle&#x22;}]]" />

  <ApiMember kind="prop" name="view.ViewContext.fov" summary="The field of view of the camera in degrees. Setting it to `0` throws an error." ret="[[{&#x22;s&#x22;:&#x22;number&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#number&#x22;}]]" />

  <ApiMember kind="prop" name="view.ViewContext.origin" summary="The position of the camera in world space." ret="[[{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;}]]" />
</ApiMembers>

## view\.ViewmodelContext<ApiTag label="object type" />

The root of the first person viewmodel. It is passed to the `override_viewmodel` event.

When the event fires, the bob and sway of the game and the viewmodel options of the cheat are
already applied. After the event, the game still adds aim punch, the offsets for ladders and for
lowered weapons, the blend of the iron sights, and the `viewmodel_offset_*` console variables.

During the callback, `arms` and `weapon` still hold the final transform and the attachments of
the last frame. If you change `angles`, they are normalized after the callback. Do not keep the
object after the callback returns.

<ApiMembers>
  <ApiMember kind="prop" name="view.ViewmodelContext.angles" summary="The angles of the viewmodel root." ret="[[{&#x22;s&#x22;:&#x22;QAngle&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/angle#qangle&#x22;}]]" />

  <ApiMember kind="prop" name="view.ViewmodelContext.arms" summary="The HUD arms that are being set up. Read-only." ret="[[{&#x22;s&#x22;:&#x22;client.C_CS2HudModelArms&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/dumped_data/schema/client/C_CS2HudModelArms&#x22;},{&#x22;s&#x22;:&#x22;?&#x22;}]]" />

  <ApiMember kind="prop" name="view.ViewmodelContext.origin" summary="The position of the viewmodel root in world space." ret="[[{&#x22;s&#x22;:&#x22;Vector&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/mathlib/vector#vector-1&#x22;}]]" />

  <ApiMember kind="prop" name="view.ViewmodelContext.weapon" summary="The HUD weapon that is attached to `arms`. Read-only." ret="[[{&#x22;s&#x22;:&#x22;client.C_CS2HudModelWeapon&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/dumped_data/schema/client/C_CS2HudModelWeapon&#x22;},{&#x22;s&#x22;:&#x22;?&#x22;}]]" />
</ApiMembers>
