S&box Wiki



What is a Camera

The camera controls the position and rotation of the rendered scene.

It also controls things like the field of view and whether or not to draw the player model.


public class FirstPersonCamera : Camera { public override void Update() { var Pawn = Local.Pawn; Position = Pawn.EyePos; Rotation = Pawn.EyeRot; FieldOfView = 80; Viewer = Pawn; } }


If you set Viewer it won't render that entity.

In first person modes you should set it to the entity you're inhabiting. In third person you should set it to null.


Setting the Camera is the same as setting a Player Controller.

public override void Respawn() { base.Respawn(); Camera = new FirstPersonCamera(); }

Like the Player Controller, this property can be changed at any time and is replicated to the client.

Special Pages



Render Time: 14ms

DB GetPage 2
Generate Html 1
SaveChanges (1) 8
Render Body 0
Render Sidebar 1