Camera
constCamera:object
Defined in: client/api.d.ts:658
Client control of the local game camera: projecting world positions through it, and driving a scripted view on its own camera layer.
Type Declaration
Section titled “Type Declaration”interpolate()
Section titled “interpolate()”interpolate(
x,y,z,lookX,lookY,lookZ,durationSeconds):void
Smoothly moves the camera from its current view to a fixed destination until reset is called.
Parameters
Section titled “Parameters”number
Destination camera world-space X coordinate.
number
Destination camera world-space Y coordinate.
number
Destination camera world-space Z coordinate.
number
Destination world-space look-at X coordinate.
number
Destination world-space look-at Y coordinate.
number
Destination world-space look-at Z coordinate.
durationSeconds
Section titled “durationSeconds”number
Transition duration in seconds; zero or less cuts.
Returns
Section titled “Returns”void
isScripted()
Section titled “isScripted()”isScripted():
boolean
Checks whether a scripted camera view is currently held.
Returns
Section titled “Returns”boolean
True while setPosition or interpolate owns the camera.
reset()
Section titled “reset()”reset():
void
Returns control to the normal gameplay camera.
Returns
Section titled “Returns”void
setPosition()
Section titled “setPosition()”setPosition(
x,y,z,lookX,lookY,lookZ):void
Cuts the camera to a fixed position and look-at target until reset is called. Streaming stays pinned to the player while a scripted view is active.
Parameters
Section titled “Parameters”number
Camera world-space X coordinate.
number
Camera world-space Y coordinate.
number
Camera world-space Z coordinate.
number
World-space X coordinate the camera looks at.
number
World-space Y coordinate the camera looks at.
number
World-space Z coordinate the camera looks at.
Returns
Section titled “Returns”void
worldToScreen()
Section titled “worldToScreen()”worldToScreen(
x,y,z):ScreenPosition
Projects a world-space position to display pixel coordinates.
Parameters
Section titled “Parameters”number
World X coordinate.
number
World Y coordinate.
number
World Z coordinate.
Returns
Section titled “Returns”ScreenPosition
Screen coordinates and whether the point is visible through the active camera.
Example
Section titled “Example”const point = Camera.worldToScreen(10, 20, 5);if (point.visible) { // point.x and point.y are display pixels.}