Home Reference Source
import {Camera} from 'spacekit/src/Camera.js'
public class | source

Camera

A wrapper for Three.js camera and controls. TODO(ian): Rename to "Viewer"

Constructor Summary

Public Constructor
public

constructor(context: Object)

Method Summary

Public Methods
public

followObject(obj: SpaceObject, position: Array<Number>)

Move the camera to follow a SpaceObject as it moves.

public

get3jsCamera(): THREE.Camera

public

get3jsCameraControls(): THREE.CameraControls

public

init()

public
public

Stop the camera from following the object.

public

update()

Update the camera position and process control inputs.

Public Constructors

public constructor(context: Object) source

Params:

NameTypeAttributeDescription
context Object

The simulation context

Public Methods

public followObject(obj: SpaceObject, position: Array<Number>) source

Move the camera to follow a SpaceObject as it moves. Currently only works for non-particlesystems.

Params:

NameTypeAttributeDescription
obj SpaceObject

SpaceObject to follow.

position Array<Number>

Position of the camera with respect to the object.

public get3jsCamera(): THREE.Camera source

Return:

THREE.Camera

The THREE.js camera object.

public get3jsCameraControls(): THREE.CameraControls source

Return:

THREE.CameraControls

The THREE.js CameraControls object.

public init() source

public isFollowingObject(): boolean source

Return:

boolean

True if camera is following object.

public stopFollowingObject() source

Stop the camera from following the object.

public update() source

Update the camera position and process control inputs.