# SmoothOrbitControls

SpeckleControls -> SmoothOrbitControls

Orbit camera controls based on Google's model-viewer implementation. Input are the angles and radius of a spherical coordinate system with a configurable origin.

#

Methods

adjustOrbit setDamperDecayTime setFieldOfView setOrbit
setRadius setTarget

#

Typedefs

SmoothOrbitControlsOptions

#

Methods

# adjustOrbit

adjustOrbit(deltaTheta: number, deltaPhi: number, deltaZoom: number): void
1

Used to adjust the current controler's target camera spherical coordinates by providing deltas. Parameters

  • deltaTheta: The adjustment for the theta angle
  • deltaPhi: The adjustment for the phi angle
  • deltaZoom: The adjustment to the radius

Returns: void

# setDamperDecayTime

setDamperDecayTime(decayMilliseconds: number)
1

Sets the dampening values for the control. A larger smoothens out the camera's movement

Parameters

  • decayMilliseconds: Decay value

Returns: void

# setFieldOfView

setFieldOfView(fov: number)
1

Sets the field of view when camera is PerspectiveCamera (opens new window)

Parameters

  • fov: Field of view value

Returns: void

# setOrbit

setOrbit(
    goalTheta?: number,
    goalPhi?: number,
    goalRadius?: number
): boolean
1
2
3
4
5

Set the absolute orbital goal of the camera. The change will be applied over a number of frames depending on configured dampening value. Returns true if invoking the method will result in the camera changing position and/or rotation, otherwise false.

Parameters

  • goalTheta: Goal theta angle
  • goalPhi: Goal phi angle
  • goalRadius: Goal radius value

Returns: boolean

# setRadius

setRadius(radius: number): void
1

Sets the radius value

Returns: void

# setTarget

setTarget(x: number, y: number, z: number): void
1

Sets the origin of the spherical coordinate system

Returns: void

#

Typedefs

# SmoothOrbitControlsOptions

export interface SmoothOrbitControlsOptions {
  enableOrbit?: boolean
  enableZoom?: boolean
  enablePan?: boolean
  orbitSensitivity?: number
  zoomSensitivity?: number
  panSensitivity?: number
  inputSensitivity?: number
  minimumRadius?: number
  maximumRadius?: number
  minimumPolarAngle?: number
  maximumPolarAngle?: number
  minimumAzimuthalAngle?: number
  maximumAzimuthalAngle?: number
  infiniteZoom?: boolean
  zoomToCursor?: boolean
  damperDecay?: number
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

The available options:

  • optional enableOrbit: Enables orbiting
  • optional enableZoom: Enables zooming
  • optional enablePan: Enables panning
  • optional orbitSensitivity: Sensitivity of rotating
  • optional zoomSensitivity: Sensitivity of zooming
  • optional panSensitivity: Sensitivity of panning
  • optional inputSensitivity: General Sensitivity
  • optional minimumRadius: The closest the camera can be to the target
  • optional maximumRadius: The farthest the camera can be from the target
  • optional minimumPolarAngle: The minimum angle between model-up and the camera polar position
  • optional maximumPolarAngle: The maximum angle between model-up and the camera polar position
  • optional minimumAzimuthalAngle: The minimum angle between model-forward and the camera azimuthal position
  • optional infiniteZoom: Enables infinite zoom
  • optional zoomToCursor: Enables scrolling to cursor
  • optional damperDecay: The dampening value for the controller