Selva Compute API Reference - v1.1.2
    Preparing search index...

    Orbit controls allow the camera to orbit around a target.

    Hierarchy (View Summary)

    Index

    Constructors

    • Parameters

      • object: Camera

        The camera to be controlled. The camera must not be a child of another object, unless that object is the scene itself.

      • OptionaldomElement: HTMLElement | SVGElement | null

        The HTML element used for event listeners. (optional)

      Returns OrbitControls

    Properties

    autoRotate: boolean

    Set to true to automatically rotate around the target. Note that if this is enabled, you must call .update() in your animation loop. If you want the auto-rotate speed to be independent of the frame rate (the refresh rate of the display), you must pass the time deltaTime, in seconds, to .update().

    autoRotateSpeed: number

    How fast to rotate around the target if .autoRotate is true. Default is 2.0, which equates to 30 seconds per orbit at 60fps. Note that if .autoRotate is enabled, you must call .update() in your animation loop.

    cursor: Vector3

    The focus point of the .minTargetRadius and .maxTargetRadius limits. It can be updated manually at any point to change the center of interest for the .target.

    dampingFactor: number

    The damping inertia used if .enableDamping is set to true. Default is 0.05. Note that for this to work, you must call .update() in your animation loop.

    domElement: HTMLElement | SVGElement | null

    The HTML element used for event listeners. If not provided via the constructor, .connect must be called after domElement has been set.

    enabled: boolean

    When set to false, the controls will not respond to user input. Default is true.

    enableDamping: boolean

    Set to true to enable damping (inertia), which can be used to give a sense of weight to the controls. Default is false. Note that if this is enabled, you must call .update() in your animation loop.

    enablePan: boolean

    Enable or disable camera panning. Default is true.

    enableRotate: boolean

    Enable or disable horizontal and vertical rotation of the camera. Default is true. Note that it is possible to disable a single axis by setting the min and max of the [polar angle].minPolarAngle or [azimuth angle].minAzimuthAngle to the same value, which will cause the vertical or horizontal rotation to be fixed at that value.

    enableZoom: boolean

    Enable or disable zooming (dollying) of the camera.

    keyPanSpeed: number

    How fast to pan the camera when the keyboard is used. Default is 7.0 pixels per keypress.

    keyRotateSpeed: number

    How fast to rotate the camera when the keyboard is used. Default is 1.

    keys: { BOTTOM: string; LEFT: string; RIGHT: string; UP: string }

    This object contains references to the keycodes for controlling camera panning. Default is the 4 arrow keys.

    maxAzimuthAngle: number

    How far you can orbit horizontally, upper limit. If set, the interval [ min, max ] must be a sub-interval of [ - 2 PI, 2 PI ], with ( max - min < 2 PI ). Default is Infinity.

    maxDistance: number

    How far you can dolly out ( PerspectiveCamera only ). Default is Infinity.

    maxPolarAngle: number

    How far you can orbit vertically, upper limit. Range is 0 to Math.PI radians, and default is Math.PI.

    maxTargetRadius: number

    How far you can move the target from the 3D .cursor. Default is Infinity.

    maxZoom: number

    How far you can zoom out ( OrthographicCamera only ). Default is Infinity.

    minAzimuthAngle: number

    How far you can orbit horizontally, lower limit. If set, the interval [ min, max ] must be a sub-interval of [ - 2 PI, 2 PI ], with ( max - min < 2 PI ). Default is Infinity.

    minDistance: number

    How far you can dolly in ( PerspectiveCamera only ). Default is 0.

    minPolarAngle: number

    How far you can orbit vertically, lower limit. Range is 0 to Math.PI radians, and default is 0.

    minTargetRadius: number

    How close you can get the target to the 3D .cursor. Default is 0.

    minZoom: number

    How far you can zoom in ( OrthographicCamera only ). Default is 0.

    mouseButtons: {
        LEFT?: MOUSE | null;
        MIDDLE?: MOUSE | null;
        RIGHT?: MOUSE | null;
    }

    This object contains references to the mouse actions used by the controls.

    object: Object3D

    The 3D object that is managed by the controls.

    panSpeed: number

    Speed of panning. Default is 1.

    position0: Vector3

    Used internally by the .saveState and .reset methods.

    rotateSpeed: number

    Speed of rotation. Default is 1.

    screenSpacePanning: boolean

    Defines how the camera's position is translated when panning. If true, the camera pans in screen space. Otherwise, the camera pans in the plane orthogonal to the camera's up direction. Default is true.

    target: Vector3

    The focus point of the controls, the .object orbits around this. It can be updated manually at any point to change the focus of the controls.

    target0: Vector3

    Used internally by the .saveState and .reset methods.

    touches: { ONE?: TOUCH | null; TWO?: TOUCH | null }

    This object contains references to the touch actions used by the controls.

    zoom0: number

    Used internally by the .saveState and .reset methods.

    zoomSpeed: number

    Speed of zooming / dollying. Default is 1.

    zoomToCursor: boolean

    Setting this property to true allows to zoom to the cursor's position. Default is false.

    Methods

    • Connects the controls to the DOM. This method has so called "side effects" since it adds the module's event listeners to the DOM.

      Parameters

      Returns void

    • Disconnects the controls from the DOM.

      Returns void

    • Call this method if you no longer want use to the controls. It frees all internal resources and removes all event listeners.

      Returns void

    • Get the current horizontal rotation, in radians.

      Returns number

    • Returns the distance from the camera to the target.

      Returns number

    • Get the current vertical rotation, in radians.

      Returns number

    • Adds key event listeners to the given DOM element. window is a recommended argument for using this method.

      Parameters

      Returns void

    • Reset the controls to their state from either the last time the .saveState was called, or the initial state.

      Returns void

    • Save the current state of the controls. This can later be recovered with .reset.

      Returns void

    • Removes the key event listener previously defined with .listenToKeyEvents().

      Returns void

    • Update the controls. Must be called after any manual changes to the camera's transform, or in the update loop if .autoRotate or .enableDamping are set. deltaTime, in seconds, is optional, and is only required if you want the auto-rotate speed to be independent of the frame rate (the refresh rate of the display).

      Parameters

      • OptionaldeltaTime: number | null

      Returns boolean