S&box Wiki

History for Camera

Revision Difference


<cat>Code.Camera</cat> <title>Camera</title> # 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. # Example ``` public class FirstPersonCamera : BaseCamera public class FirstPersonCamera : Camera { public override void Update() { Pos = TargetEntity.EyePos; Rot = TargetEntity.EyeRot; var Pawn = Local.Pawn; Pos = Pawn.EyePos; Rot = Pawn.EyeRot; FieldOfView = 80; Viewer = TargetEntity; Viewer = Pawn; } } ``` # Viewer 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 Setting the Camera is the same as setting a <page>Player Controller</page>. ``` public override void Respawn() { base.Respawn(); Camera = new FirstPersonCamera(); } ``` Like the <page>Player Controller</page>, this property can be changed at any time and is replicated to the client.

Special Pages



Render Time: 30ms

DB GetPage 23
Get RevNew 1
Get RevOld 2
Render Body 0
Render Sidebar 2