Изменить

Поделиться через


Camera Class

Contains methods relating to the active camera for the specified player.

Properties

isValid

read-only isValid: boolean;

Returns whether the Camera is valid to access and use. A Camera is considered valid when the owning Player of the Camera is loaded and valid itself.

Type: boolean

Methods

clear

clear(): void

Clears the active camera for the specified player. Causes the specified players to end any in-progress camera perspectives, including any eased camera motions, and return to their normal perspective.

Notes:

  • This function can't be called in read-only mode.
  • This function can throw errors.

fade

fade(fadeCameraOptions?: CameraFadeOptions): void

Begins a camera fade transition. A fade transition is a full-screen color that fades-in, holds, and then fades-out.

Parameters

  • fadeCameraOptions?: CameraFadeOptions = null

    Additional options around camera fade operations.

Notes:

  • This function can't be called in read-only mode.
  • This function can throw errors.

setCamera

setCamera(cameraPreset: string, setOptions?: CameraFixedBoomOptions | CameraSetFacingOptions | CameraSetLocationOptions | CameraSetPosOptions | CameraSetRotOptions | CameraTargetOptions): void

Sets the current active camera for the specified player.

Parameters

Notes:

  • This function can't be called in read-only mode.
  • This function can throw errors.

setDefaultCamera

setDefaultCamera(cameraPreset: string, easeOptions?: EaseOptions): void

Sets the current active camera for the specified player and resets the position and rotation to the values defined in the JSON.

Parameters

  • cameraPreset: string

    Identifier of a camera preset file defined within JSON.

  • easeOptions?: EaseOptions = null

    Options to ease the camera back to its original position and rotation.

Notes:

  • This function can't be called in read-only mode.
  • This function can throw errors.

setFov

setFov(fovCameraOptions?: CameraFovOptions): void

Parameters

Caution

This function is still in pre-release. Its signature may change or it may be removed in future releases.

Notes:

  • This function can't be called in read-only mode.
  • This function can throw errors.