# 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)
1
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>>)
1
2

Gets/sets any options the controls implementation might need

Returns: Partial<Record<string, unknown>>

# targetCamera

abstract set targetCamera(target: PerspectiveCamera | OrthographicCamera)
1

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)
1
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
1

Disposes of the controls implementation

Returns: void

# fitToSphere

abstract fitToSphere(sphere: Sphere): void
1

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

Returns: void

# fromPositionAndTarget

abstract fromPositionAndTarget(position: Vector3, target: Vector3): void
1

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

# getPosition

abstract getPosition(): Vector3
1

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
1

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
1

Determines whether the control's camera target is stationary or not.

Returns: boolean

# jumpToGoal

abstract jumpToGoal(): void
1

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
1

The control's update loop

Parameters

  • delta(optional): Frame delta time

Returns: void