s&box

Camera

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 override void Update() { Pos = TargetEntity.EyePos; Rot = TargetEntity.EyeRot; FieldOfView = 80; Viewer = TargetEntity; } }

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 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.

Page Links


Special Pages


Wikis

?

Render Time: 53ms

DB GetPage 38
Generate Html 1
SaveChanges (1) 11
Render Body 0
Render Sidebar 0