Viewer
    Preparing search index...

    Interface IPerspectiveCameraApi

    The api for a perspective camera. A perspective camera can be created by calling the createPerspectiveCamera method. A camera has a multitude of properties and methods that can be used to adjust the behavior.

    interface IPerspectiveCameraApi {
        autoAdjust: boolean;
        autoRotationSpeed: number;
        cameraMovementDuration: number;
        cubePositionRestriction: { max: vec3; min: vec3 };
        cubeTargetRestriction: { max: vec3; min: vec3 };
        damping: number;
        defaultPosition: vec3;
        defaultTarget: vec3;
        enableAutoRotation: boolean;
        enableAzimuthRotation: boolean;
        enabled: boolean;
        enableKeyPan: boolean;
        enableObjectControls: boolean;
        enablePan: boolean;
        enablePolarRotation: boolean;
        enableRotation: boolean;
        enableTurntableControls: boolean;
        enableZoom: boolean;
        fov: number;
        id: string;
        initialAutoAdjust: boolean;
        isDefault: boolean;
        keyPanSpeed: number;
        movementSmoothness: number;
        objectControlsCenter: vec3;
        panSpeed: number;
        position: vec3;
        revertAtMouseUp: boolean;
        revertAtMouseUpDuration: number;
        rotationRestriction: {
            maxAzimuthAngle: number;
            maxPolarAngle: number;
            minAzimuthAngle: number;
            minPolarAngle: number;
        };
        rotationSpeed: number;
        spherePositionRestriction: { center: vec3; radius: number };
        sphereTargetRestriction: { center: vec3; radius: number };
        target: vec3;
        turntableCenter: vec3;
        type: CAMERA_TYPE;
        zoomRestriction: { maxDistance: number; minDistance: number };
        zoomSpeed: number;
        zoomToFactor: number;
        animate(
            path: { position: vec3; target: vec3 }[],
            options?: ICameraOptions,
        ): Promise<boolean>;
        calculateZoomTo(
            zoomTarget?: IBox,
            startingPosition?: vec3,
            startingTarget?: vec3,
        ): { position: vec3; target: vec3 };
        project(p: vec3): vec2;
        reset(options?: ICameraOptions): Promise<boolean>;
        set(
            position: vec3,
            target: vec3,
            options?: ICameraOptions,
        ): Promise<boolean>;
        unproject(p: vec3): vec3;
        zoomTo(zoomTarget?: IBox, options?: ICameraOptions): Promise<boolean>;
        name?: string;
        order?: number;
    }

    Hierarchy (View Summary)

    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.

    cubeTargetRestriction: { max: vec3; min: vec3 }

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

    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)

    enabled: boolean

    Option to enable / disable the movement of the camera.

    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.

    fov: number

    The field of view for the camera.

    id: string

    The id of the camera.

    initialAutoAdjust: boolean

    If the camera should automatically adjust to the size of the scene whenever the scene is loaded for the first time.

    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.

    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.

    sphereTargetRestriction: { center: vec3; radius: number }

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

    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.

    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

    • Let the camera follow a path along pairs of position and target.

      Parameters

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

        The defined path.

      • Optionaloptions: ICameraOptions

        Various options to be adjusted.

      Returns Promise<boolean>

    • 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.

      Parameters

      • OptionalzoomTarget: IBox

        The target to zoom to.

      • OptionalstartingPosition: vec3

        The starting position of the camera.

      • OptionalstartingTarget: vec3

        The starting target of the camera.

      Returns { position: vec3; target: vec3 }

    • 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 / animate the camera to a specific position and target.

      Parameters

      • position: vec3
      • target: vec3
      • Optionaloptions: ICameraOptions

        Various options to be adjusted.

      Returns Promise<boolean>

    • 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

      • OptionalzoomTarget: IBox

        The target to zoom to.

      • Optionaloptions: ICameraOptions

        Various options to be adjusted.

      Returns Promise<boolean>