Reference Source
public class | source

CameraControl

Extends:

Component → CameraControl

Controls a Camera with keyboard, mouse and touch input.

Located for convenience at Viewer#cameraControl.

Fires these events:

Member Summary

Public Members
public set

active(value: Boolean)

Sets if this CameraControl is active or not.

public get

Gets if this CameraControl is active or not.

public get

Gets whether double-picking an Entity causes the Camera to fly to its boundary.

public set

Sets whether double-picking an Entity causes the Camera to fly to its boundary.

public get

Gets whether this CameraControl is in first-person mode.

public set

Sets whether this CameraControl is in first-person mode.

public get

Gets the inertia factor.

public set

inertia(value: Number)

Sets a factor in range [0..1] indicating how much the camera keeps moving after you finish panning or rotating it.

public get

Gets whether right-clicking pans the Camera.

public set

Sets whether right-clicking pans the Camera.

public get

Gets whether scrolling the mouse wheel, when mouse is over an Entity, will zoom the Camera towards the pivot point.

public set

Sets whether scrolling the mouse wheel, when mouse is over an Entity, will zoom the Camera towards the pivot point.

public set

Sets whether scrolling the mouse wheel, when the mouse is over an Entity, will zoom the Camera towards the hovered point on the Entity's surface.

Default value is false.

public get

Gets whether scrolling the mouse wheel, when the mouse is over an Entity, will zoom the Camera towards the hovered point on the Entity's surface.

Default value is false.

public set

pivotPos(worldPos: Number[])

Sets the current World-space 3D pivot position.

public get

Gets the current World-space 3D pivot position.

public get

Sets whether dragging will pivot the Camera about the current 3D pivot point.

public set

pivoting(value: Boolean)

Sets whether dragging will pivot the Camera about the current 3D pivot point.

public get

Gets whether this CameraControl is in plan-view mode.

public set

planView(value: Boolean)

Sets whether this CameraControl is in plan-view mode.

public set

Sets whether canvas pointer events are enabled.

public get

Gets whether canvas pointer events are enabled.

public set

walking(value: Boolean)

Sets whether this CameraControl is in walking mode.

public get

Gets whether this CameraControl is in walking mode.

Method Summary

Public Methods
public

Inherited Summary

From class Component
public get

The Component that owns the lifecycle of this Component, if any.

public

True as soon as this Component has been destroyed

public

ID of this Component, unique within the Scene.

public

meta: *

Arbitrary, user-defined metadata on this component.

public

The parent Scene that contains this Component.

public

The viewer that contains this Scene.

public

clear()

Destroys all Components that are owned by this.

public

Destroys this component.

public

error(message: String)

Logs an error for this component to the JavaScript console.

public

fire(event: String, value: Object, forget: Boolean)

Fires an event on this component.

public

Returns true if there are any subscribers to the given event on this component.

public

isType(type: *): *: Boolean

Tests if this component is of the given type, or is a subclass of the given type.

public

log(message: String)

Logs a console debugging message for this component.

public

off(subId: String)

Cancels an event subscription that was previously made with Component#on or Component#once.

public

on(event: String, callback: Function, scope: Object): String

Subscribes to an event on this component.

public

once(event: String, callback: Function, scope: Object)

Subscribes to the next occurrence of the given event, then un-subscribes as soon as the event is subIdd.

public

warn(message: String)

Logs a warning for this component to the JavaScript console.

Public Members

public set active(value: Boolean) source

Sets if this CameraControl is active or not.

Default value is true.

public get active: Boolean: * source

Gets if this CameraControl is active or not.

Default value is true.

Return:

Boolean

Returns true if this CameraControl is active.

public get doublePickFlyTo: Boolean: * source

Gets whether double-picking an Entity causes the Camera to fly to its boundary.

Default value is false.

Return:

Boolean

Returns true when double-pick-fly-to mode is enabled.

public set doublePickFlyTo(value: Boolean) source

Sets whether double-picking an Entity causes the Camera to fly to its boundary.

Default value is false.

public get firstPerson: Boolean: * source

Gets whether this CameraControl is in first-person mode.

In "first person" mode (disabled by default) the look position rotates about the eye position. Otherwise, Camera#eye rotates about Camera#look.

Default value is false.

Return:

Boolean

Returns true if first-person mode is enabled.

public set firstPerson(value: Boolean) source

Sets whether this CameraControl is in first-person mode.

In "first person" mode (disabled by default) the look position rotates about the eye position. Otherwise, Camera#eye rotates about Camera#look.

Default value is false.

public get inertia: Number: * source

Gets the inertia factor.

Default value is 0.5.

Return:

Number

The inertia factor.

public set inertia(value: Number) source

Sets a factor in range [0..1] indicating how much the camera keeps moving after you finish panning or rotating it.

A value of 0.0 causes it to immediately stop, 0.5 causes its movement to decay 50% on each tick, while 1.0 causes no decay, allowing it continue moving, by the current rate of pan or rotation.

You may choose an inertia of zero when you want be able to precisely position or rotate the camera, without interference from inertia. ero inertia can also mean that less frames are rendered while you are positioning the camera.

Default value is 0.5.

public get panRightClick: Boolean: * source

Gets whether right-clicking pans the Camera.

Default value is true.

Return:

Boolean

Returns false when pan on right-click is disabled.

public set panRightClick(value: Boolean) source

Sets whether right-clicking pans the Camera.

Default value is true.

public get panToPivot: Boolean: * source

Gets whether scrolling the mouse wheel, when mouse is over an Entity, will zoom the Camera towards the pivot point.

Default value is false.

Return:

Boolean

Returns true if enable pan-to-pivot behaviour is enabled.

public set panToPivot(value: Boolean) source

Sets whether scrolling the mouse wheel, when mouse is over an Entity, will zoom the Camera towards the pivot point.

Default value is false.

public set panToPointer(value: Boolean) source

Sets whether scrolling the mouse wheel, when the mouse is over an Entity, will zoom the Camera towards the hovered point on the Entity's surface.

Default value is false.

public get panToPointer: Boolean: * source

Gets whether scrolling the mouse wheel, when the mouse is over an Entity, will zoom the Camera towards the hovered point on the Entity's surface.

Default value is false.

Return:

Boolean

Returns true if pan-to-pointer behaviour is enabled.

public set pivotPos(worldPos: Number[]) source

Sets the current World-space 3D pivot position.

public get pivotPos: Number[]: * source

Gets the current World-space 3D pivot position.

Return:

Number[]

worldPos The current World-space 3D pivot position.

public get pivoting: Boolean: * source

Sets whether dragging will pivot the Camera about the current 3D pivot point.

The pivot point is indicated by CameraControl#pivotPos.

When in pivoting mode, clicking on an Entity will set CameraControl#pivotPos to the clicked position on the surface of the Entity.

Default value is false.

Return:

Boolean

Returns true to enable pivoting.

public set pivoting(value: Boolean) source

Sets whether dragging will pivot the Camera about the current 3D pivot point.

The pivot point is indicated by CameraControl#pivotPos.

When in pivoting mode, clicking on an Entity will set CameraControl#pivotPos to the clicked position on the surface of the Entity.

Default value is false.

public get planView: Boolean: * source

Gets whether this CameraControl is in plan-view mode.

When in plan-view mode, rotation is disabled.

Default value is false.

Return:

Boolean

Returns true if plan-view mode is enabled.

public set planView(value: Boolean) source

Sets whether this CameraControl is in plan-view mode.

When in plan-view mode, rotation is disabled.

Default value is false.

public set pointerEnabled(value: Boolean) source

Sets whether canvas pointer events are enabled.

Default value is true.

public get pointerEnabled: Boolean: * source

Gets whether canvas pointer events are enabled.

Default value is true.

Return:

Boolean

Returns true to enable drag events.

public set walking(value: Boolean) source

Sets whether this CameraControl is in walking mode.

When set true, this constrains Camera#eye movement to the horizontal X-Z plane. When doing a walkthrough, this is useful to allow us to look upwards or downwards as we move, while keeping us moving in the horizontal plane.

This only has an effect when CameraControl#firstPerson is true.

Default value is false.

public get walking: Boolean: * source

Gets whether this CameraControl is in walking mode.

When set true, this constrains Camera#eye movement to the horizontal X-Z plane. When doing a walkthrough, this is useful to allow us to look upwards or downwards as we move, while keeping us moving in the horizontal plane.

This only has an effect when CameraControl#firstPerson is true.

Default value is false.

Return:

Boolean

Returns true when in walking mode.

Public Methods

public destroy() source

Destroys this component.

Override:

Component#destroy