Revision Difference
Camera#548296
<cat>Code.Camera</cat>
<title>Camera</title>
# Introduction
The old CameraMode is now simply known as Camera, this allowed for the reduction of base S&box code so this is now the method for controlling the game camera. This is a clientside global variable that can be called anywhere.
# Example usage
It is recommended to put your camera code in an event called every frame such as `[Event.Client.Frame]` or `[Event.Client.PostCam]` [Event System](https://wiki.facepunch.com/sbox/EventSystem), or a method such as `FrameSimulate`
```
public override void FrameSimulate( Client cl )
{
Camera.Rotation = ViewAngles.ToRotation();
Camera.Position = EyePosition;
Camera.FieldOfView = Local.UserPreference.FieldOfView;
Camera.FirstPersonViewer = this;
Camera.ZNear = 1f;
Camera.ZFar = 5000.0f;
}
public override void FrameSimulate( Client cl )
{
Camera.Rotation = ViewAngles.ToRotation();
Camera.Position = EyePosition;
Camera.FieldOfView = Local.UserPreference.FieldOfView;
Camera.FirstPersonViewer = this;
Camera.ZNear = 1f;
Camera.ZFar = 5000.0f;
}
```