# Class BimCamera

##### Index

### Constructors

constructor

### Accessors

cameraOptions
mode
pivotOptions

### Methods

attachBehavior
defaultView
detachBehavior
forwardVector
getViewAsString
lock
lookAt
lookFrom
setLock
setMode
setPivot
setProjection
setViewFromString
unlock
zoomToExtent

## Constructors

### constructor

- new BimCamera(_viewer: TwinfinityViewer, _api: BimCoreApi): BimCamera
  `Internal`

  NOTE: Internal API. Subject to change. Use of these APIs in production applications is not supported.

  #### Parameters

  - _viewer: TwinfinityViewer
  - _api: BimCoreApi

  #### Returns BimCamera

## Accessors

### cameraOptions

- get cameraOptions(): CameraOptions

  Gets or sets options for camera pivot control.

  #### Returns CameraOptions

### mode

- get mode(): CameraMode

  Gets the camera mode (pivot, fps or all). See CameraMode for more information

  #### Returns CameraMode

- set mode(mode: CameraMode): void

  Sets the camera mode (pivot, fps or all). See CameraMode for more information

  #### Parameters

  - mode: CameraMode

  #### Returns void

### pivotOptions

- get pivotOptions(): CameraOptions

  #### Returns CameraOptions

  #### Deprecated

  Same as cameraOptions.

## Methods

### attachBehavior

- attachBehavior(behavior: TwinfinityCameraBehavior): boolean

  Attaches a behavior to the camera.

  #### Parameters

  - behavior: TwinfinityCameraBehavior

    The behavior to be attached to the camera.

  #### Returns boolean

  true if the behavior was successfully attached to the camera, otherwise false.

### defaultView

- defaultView(direction?: CameraDirection): void

  Resets the camera to the default view. Camera is positioned to view entire building

  #### Parameters

  - `Optional` direction: CameraDirection

    Optional. Direction camera should look at building from. Default is a angled top position.

  #### Returns void

### detachBehavior

- detachBehavior(behavior: TwinfinityCameraBehavior): boolean

  Detaches a behavior from the camera.

  #### Parameters

  - behavior: TwinfinityCameraBehavior

    The behavior to be detached from the camera.

  #### Returns boolean

  true if the behavior was successfully detached to the camera, otherwise false.

### forwardVector

- forwardVector(): Vector3

  Returns camera forward vector.

  #### Returns Vector3

### getViewAsString

- getViewAsString(): string

  Returns the current camera position and target as a string

  #### Returns string

### lock

- lock(): void

  #### Returns void

  #### Deprecated

  Use cameraOptions instead Locks camera to prevent user interaction.

### lookAt

- lookAt(eye: Vector3, target: Vector3): void

  Sets camera position at eye and rotation to look towards target.

  #### Parameters

  - eye: Vector3

    Point to look from.

  - target: Vector3

    Point to look towards.

  #### Returns void

### lookFrom

- lookFrom(direction: CameraDirection): void

  Sets camera rotation to look towards the specified direction and zooms to extent of visible objects.

  #### Parameters

  - direction: CameraDirection

    The direction to look from (top = -Z, bottom = +Z, front = +Y, back = -Y, left = +X, right = -X).

  #### Returns void

### setLock

- setLock(locked: boolean): void

  #### Parameters

  - locked: boolean

    Whether camera should be locked or not.

  #### Returns void

  #### Deprecated

  Use cameraOptions instead Sets whether camera should prevent user interaction or not.

### setMode

- setMode(mode: CameraMode): void

  #### Parameters

  - mode: CameraMode

    The camera mode to set.

  #### Returns void

  #### Deprecated

  Use the mode property instead Sets camera mode.

### setPivot

- setPivot(mode: Auto): void

  Sets the pivot point to use a (mouse, touch) cursor-based pivot point (Auto).

  #### Parameters

  - mode: Auto

    Should be PivotMode.Auto

  #### Returns void

- setPivot(mode: Fixed, pivot: Vector3 | BimIfcObject): void

  Sets the pivot point to a fixed point.

  #### Parameters

  - mode: Fixed

    Should be PivotMode.Fixed

  - pivot: Vector3 | BimIfcObject

    The object or point that the camera should pivot around.

  #### Returns void

### setProjection

- setProjection(projection: CameraProjection): void

  Sets camera projection.

  #### Parameters

  - projection: CameraProjection

    The camera projection to set.

  #### Returns void

### setViewFromString

- setViewFromString(viewString: string): void

  Sets the camera's position and target from given string

  #### Parameters

  - viewString: string

    A string generated by getViewAsString

  #### Returns void

### unlock

- unlock(): void

  #### Returns void

  #### Deprecated

  Use Use cameraOptions instead Unlocks camera to allow for user interaction.

### zoomToExtent

- zoomToExtent(extent: Bound, direction?: CameraDirection): void

  Zooms camera to the extent of the specified bounding box.

  #### Parameters

  - extent: Bound

    Bounding box in format [minX, minY, minZ, maxX, maxY, maxZ].

  - `Optional` direction: CameraDirection

    [Optional]. If set, the camera is positioned according to the direction during zoom. Otherwise, the current direction is kept.

  #### Returns void