Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface ICameraApi

The api for a camera, please see the definitions for the perspective camera api and the orthographic camera api as this is just a shared interface for both. A camera can be created by calling the corresponding method in the IViewportApi. A camera has a multitude of properties and methods that can be used to adjust the behavior.

Hierarchy

Index

Properties

autoAdjust: boolean

Option to automatically adjust the camera to the size of the scene whenever a call to ISessionApi.customize replaced ISessionApi.node. This does not happen in case ISessionApi.automaticSceneUpdate is set to false.

autoRotationSpeed: number

The speed of the camera for auto rotating.

cameraMovementDuration: number

The standard duration for camera movements.

cubePositionRestriction: { max: vec3; min: vec3 }

The restrictions for the position of the camera with a cube.

Type declaration

  • max: vec3
  • min: vec3
cubeTargetRestriction: { max: vec3; min: vec3 }

The restrictions for the target of the camera with a cube.

Type declaration

  • max: vec3
  • min: vec3
damping: number

The damping factor for the camera. The dampening affects how much the camera moves even after you let it got. This smooths the usage of the camera.

defaultPosition: vec3

The default position of the camera.

defaultTarget: vec3

The default target of the camera.

enableAutoRotation: boolean

Option to enable auto rotating.

enableAzimuthRotation: boolean

Option to enable the rotation of the camera on the azimuth axis (left/right). (default: true)

enableKeyPan: boolean

Option to enable panning with key presses.

enableObjectControls: boolean

Option to enable the object controls. (default: false)

enablePan: boolean

Option to enable panning. Panning can be done by pressing the right mouse button or three-finger touch events.

enablePolarRotation: boolean

Option to enable the rotation of the camera on the polar axis (up/down). (default: true)

enableRotation: boolean

Option to enable rotating.

enableTurntableControls: boolean

Option to enable the turntable controls. (default: false)

enableZoom: boolean

Option to enable zooming. Zooming can be done with the mouse wheel or two-finger touch events.

enabled: boolean

Option to enable / disable the movement of the camera.

id: string

The id of the camera.

isDefault: boolean

If the camera is the default camera of the viewport.

keyPanSpeed: number

The speed of the camera for key panning. The higher this value, the faster you can pan.

movementSmoothness: number

The factor for applying smoothing to the camera movement. The various events that come in are blended together to ensure that extremes are not as pronounced.

objectControlsCenter: vec3

The center of the object when enableObjectControls is activated. (default: [0,0,0])

panSpeed: number

The speed of the camera for panning. The higher this value, the faster you can pan.

position: vec3

The current position of the camera.

revertAtMouseUp: boolean

Option to animate the camera position and target to their defaults whenever the mouse/touch up event is fired.

revertAtMouseUpDuration: number

The standard duration for revertAtMouseUp animations.

rotationRestriction: { maxAzimuthAngle: number; maxPolarAngle: number; minAzimuthAngle: number; minPolarAngle: number }

The restrictions for the rotation of the camera.

Type declaration

  • maxAzimuthAngle: number
  • maxPolarAngle: number
  • minAzimuthAngle: number
  • minPolarAngle: number
rotationSpeed: number

The speed of the camera for rotating.

spherePositionRestriction: { center: vec3; radius: number }

The restrictions for the position of the camera with a sphere.

Type declaration

  • center: vec3
  • radius: number
sphereTargetRestriction: { center: vec3; radius: number }

The restrictions for the target of the camera with a sphere.

Type declaration

  • center: vec3
  • radius: number
target: vec3

The current target of the camera.

turntableCenter: vec3

The center of the turntable when enableTurntableControls is activated. (default: [0,0,0])

The type of camera that is being used.

zoomRestriction: { maxDistance: number; minDistance: number }

The restrictions for the zooming of the camera.

Type declaration

  • maxDistance: number
  • minDistance: number
zoomSpeed: number

The speed of the camera for zooming. The higher this value, the faster you can zoom.

zoomToFactor: number

The factor that is used when the zoomTo function is called.

See also calculateZoomTo

name?: string

The name of the camera. Used by the platform.

order?: number

Optional order property for the camera. Used by the platform.

Methods

  • animate(path: { position: vec3; target: vec3 }[], options?: ICameraOptions): Promise<boolean>
  • Let the camera follow a path along pairs of position and target.

    Parameters

    • path: { position: vec3; target: vec3 }[]

      The defined path.

    • Optional options: ICameraOptions

      Various options to be adjusted.

    Returns Promise<boolean>

  • calculateZoomTo(zoomTarget?: IBox, startingPosition?: vec3, startingTarget?: vec3): { position: vec3; target: vec3 }
  • Calculate the position and target which a call to zoomTo would result in.

    If no target to zoom to is provided, the current bounding box is used. If no startingPosition and startingTarget are provided, the current camera position and target are used.

    see

    zoomToFactor

    Parameters

    • Optional zoomTarget: IBox

      The target to zoom to.

    • Optional startingPosition: vec3

      The starting position of the camera.

    • Optional startingTarget: vec3

      The starting target of the camera.

    Returns { position: vec3; target: vec3 }

    • position: vec3
    • target: vec3
  • project(p: vec3): vec2
  • Projects the vector from world space into the camera's normalized device coordinate (NDC) space.

    Parameters

    • p: vec3

      The point in the scene to project.

    Returns vec2

  • Reset / animate the camera to its default position and target.

    Parameters

    Returns Promise<boolean>

  • set(position: vec3, target: vec3, options?: ICameraOptions): Promise<boolean>
  • Set / animate the camera to a specific position and target.

    Parameters

    • position: vec3
    • target: vec3
    • Optional options: ICameraOptions

      Various options to be adjusted.

    Returns Promise<boolean>

  • unproject(p: vec3): vec3
  • Projects the vector from the camera's normalized device coordinate (NDC) space into world space.

    Parameters

    • p: vec3

      The point on the screen to project.

    Returns vec3

  • Zoom to a specific part of the scene, or the whole scene (default).

    Parameters

    • Optional zoomTarget: IBox

      The target to zoom to.

    • Optional options: ICameraOptions

      Various options to be adjusted.

    Returns Promise<boolean>