Skip to content

Camera

The Arcrotate camera can be controlled via the API. The camera can be moved, rotated and zoomed. You can set the target, alpha, beta, radius and fov of the camera.


camera.target

Set the target of the camera. The target is the point the camera is looking at. If no argument is provided, the current target will be returned.

GET | SET camera.target(position?: [x: number, y: number, z: number]): Promise<[x: number, y: number, z: number]>
js
api.camera.target([0, 0, 0])
js
actions: [{ name: 'camera.target', arg: [0, 0, 0] }]

camera.alpha

Set the alpha (rotation around the y-axis) of the camera. In radians. If no argument is provided, the current alpha will be returned.

GET | SET camera.alpha(alpha?: number): Promise<number>
js
api.camera.alpha(Math.PI / 4)
js
actions: [{ name: 'camera.alpha', arg: 1 }]

camera.beta

Set the beta (angle from the horizon) of the camera. In radians. If the beta is set to 0, the camera is looking straight down. If the beta is set to PI, the camera is looking straight up. If no argument is provided, the current beta will be returned.

GET | SET camera.beta(alpha?: number): Promise<number>
js
api.camera.beta(Math.PI / 4)
js
actions: [{ name: 'camera.beta', arg: 1 }]

camera.rotations

Set the alpha and beta of the camera. In radians. If no argument is provided, the current alpha and beta will be returned.

GET | SET camera.rotations(alpha: number, beta: number): Promise<[alpha: number, beta: number]>
js
api.camera.rotations([Math.PI / 4, Math.PI / 4]).then((result) => console.log(result))
// [0.7853981633974483, 0.7853981633974483]
js
actions: [{ name: 'camera.rotations', arg: [0.75, 0.75] }]

camera.radius

Set the radius (distance from the target) of the camera. In meters. If no argument is provided, the current radius will be returned.

GET | SET camera.radius(radius?: number): Promise<number>
js
api.camera.radius(5)
js
actions: [{ name: 'camera.radius', arg: 5 }]

camera.fov

Get or Set the field of view of the camera in radians. If no argument is provided, the current fov will be returned.

GET | SET camera.fov(fov?: number): Promise<number>
js
api.camera.fov(Math.PI / 2)
js
actions: [{ name: 'camera.fov', arg: 1 }]