# SpeckleControls
Abstract base class for all camera controls implementations
# Accessors
enabled | options | targetCamera | up |
---|
# Methods
dispose | fitToSphere | fromPositionAndTarget | getPosition |
---|---|---|---|
getTarget | isStationary | jumpToGoal | update |
# Accessors
# enabled
abstract get enabled(): boolean
abstract set enabled(value: boolean)
2
Gets/sets the enabled state of the controls
Returns: boolean
# options
abstract get options(): Partial<Record<string, unknown>>
abstract set options(value: Partial<Record<string, unknown>>)
2
Gets/sets any options the controls implementation might need
Returns: Partial<Record<string, unknown>>
# targetCamera
abstract set targetCamera(target: PerspectiveCamera | OrthographicCamera)
Sets the camera that will be controls by this controls instance. It only accepts PerspectiveCamera (opens new window) or OrthographicCamera (opens new window) instances
Returns: void
# up
public get up()
public set up(value: Vector3)
2
Sets the up vector this controls instance will use to compute the camera position and rotation. Default value is (0, 1, 0)
, however speckle data is represented in a coordinate system where up is (0, 0, 1)
Returns: Vector3 (opens new window)
# Methods
# dispose
abstract dispose(): void
Disposes of the controls implementation
Returns: void
# fitToSphere
abstract fitToSphere(sphere: Sphere): void
All controls implementations need to be able to position and orient themselves according to an input Sphere (opens new window)
WARNING
The sphere
argument is provided in a coordinate system where up is (0, 1, 0)
Parameters
- sphere: Sphere (opens new window)
Returns: void
# fromPositionAndTarget
abstract fromPositionAndTarget(position: Vector3, target: Vector3): void
Sets the controller's goal position and rotation based on a given location and another location to 'lookAt'. All controls implementation need to be able to position and orient themselves according to these two vectors.
WARNING
Both arguments are in a coordinate system where up is (0, 1, 0)
Parameters
- position: The desired camera position as Vector3 (opens new window)
- target: A position in space where the camera should 'lookAt' as Vector3 (opens new window) Returns: void
# getPosition
abstract getPosition(): Vector3
Gets the current goal position of the control's target camera
WARNING
The returned vector is in a coordinate system where up is (0, 1, 0)
Returns: Vector3 (opens new window)
# getTarget
abstract getTarget(): Vector3
Gets the current goal look position of the control's target camera
WARNING
The returned vector is in a coordinate system where up is (0, 1, 0)
Returns: Vector3 (opens new window)
# isStationary
abstract isStationary(): boolean
Determines whether the control's camera target is stationary or not.
Returns: boolean
# jumpToGoal
abstract jumpToGoal(): void
Immediately sets the control's target camera position and rotation to their goal values. Effectively skipping over any potential camera animation
Returns: void
# update
abstract update(delta?: number): boolean
The control's update loop
Parameters
- delta(optional): Frame delta time
Returns: void