Camera
constCamera:object
Defined in: server/api.d.ts:4068
One player’s view, directed from the server. A shot is sent and forgotten: the server keeps no record of it, so a player who reconnects or changes level has their own view until they are sent another.
Type Declaration
Section titled “Type Declaration”clearShot()
Section titled “clearShot()”clearShot(
player,duration?):boolean
Gives a player their own view back. Harmless for a player without a shot.
Parameters
Section titled “Parameters”player
Section titled “player”Whose view to give back.
duration?
Section titled “duration?”number
How long the glide back into the player’s eyes takes, in milliseconds: 0, the default, is a cut, and the most is 60000.
Returns
Section titled “Returns”boolean
True when it was sent.
setShot()
Section titled “setShot()”setShot(
player,options):boolean
Films one player’s view from a fixed point: what a cutscene, an intro or a kill cam is made of. It holds until clearShot, or glides on to the next setShot.
This is the client’s Camera.setShot, sent to that player; whichever of the two comes last wins. Nothing about the player’s controls changes, and nothing about where their body is: their character stays where it stood, drawn head and all for as long as the camera is looking at it from outside its eyes. A player flying with NoClip refuses the shot.
Parameters
Section titled “Parameters”player
Section titled “player”Whose view to film.
options
Section titled “options”position is where the camera stands and lookAt the point it faces, both in world space. duration is how long it takes to get there from wherever the player’s view is, in milliseconds: 0, the default, is a cut, and the most is 60000. fov is the vertical field of view in degrees, 20 to 120; leave it out to keep the player’s own.
duration?
Section titled “duration?”number
number
lookAt
Section titled “lookAt”position
Section titled “position”Returns
Section titled “Returns”boolean
True when the shot was sent, false when position and lookAt are the same point.