# Interface TwinfinityTargetCameraExtensions

Includes methods and properties for querying and manipulating a Camera instance.

interface TwinfinityTargetCameraExtensions {
hasMovedInCurrentFrame: boolean;
isFreeLook: boolean;
perspectiveDistanceFromOrtho: number;
pivot: TwinfinityCameraPivot;
get viewer(): undefined | TwinfinityViewer;
clearHasMovedInCurrentFrame(): void;
computeOrthographicZoomSpeed(distance: number): number;
createPickingRayToRef(dst: Ray, o: CanvasPosition): Ray;
getFrustumToRef(dst: FrustumPlanes): FrustumPlanes;
getOrthoFrustumSizeToRef(dst: Vertex2): Vertex2;
pick(o: PickOption): PickResult;
setOrtho(o: { distance: number } | { height: number }): void;
stateSnapshot(): TwinfinityCameraStateSnapshot;
}

#### Hierarchy (View Summary)

- TwinfinityCameraExtensions
  - TwinfinityTargetCameraExtensions

##### Index

### Properties

hasMovedInCurrentFrame
isFreeLook
perspectiveDistanceFromOrtho
pivot

### Accessors

viewer

### Methods

clearHasMovedInCurrentFrame
computeOrthographicZoomSpeed
createPickingRayToRef
getFrustumToRef
getOrthoFrustumSizeToRef
pick
setOrtho
stateSnapshot

## Properties

### `Readonly` hasMovedInCurrentFrame

hasMovedInCurrentFrame: boolean

`true` if the camera has somehow moved during this frame. Otherwise `false`. Will automatically be reset to `false` after each frame has rendered (if camera is used by TwinfinityViewer).

Inherited from TwinfinityCameraExtensions.hasMovedInCurrentFrame

### isFreeLook

isFreeLook: boolean

If `true` then camera acts like a free camera during rotation and rotation is relative to camera's own axes (first person camera).

### `Readonly` perspectiveDistanceFromOrtho

perspectiveDistanceFromOrtho: number

Gets the distance that the camera has to be positioned at (perpendicular to pivot plane) when in perspective mode to get approximately the same view. The objects in the center of the frustum will appear to have almost the same size.

Inherited from TwinfinityCameraExtensions.perspectiveDistanceFromOrtho

### `Readonly` pivot

pivot: TwinfinityCameraPivot

Includes methods and properties for camera manipulation around a pivot plane and point.

## Accessors

### viewer

- get viewer(): undefined | TwinfinityViewer

  Twinfinity viewer instance.

  #### Returns undefined | TwinfinityViewer

  Inherited from TwinfinityCameraExtensions.viewer

## Methods

### clearHasMovedInCurrentFrame

- clearHasMovedInCurrentFrame(): void

  Sets hasMovedInCurrentFrame to `false`.

  #### Returns void

  Inherited from TwinfinityCameraExtensions.clearHasMovedInCurrentFrame

### computeOrthographicZoomSpeed

- computeOrthographicZoomSpeed(distance: number): number
  `Internal`

  Is used by orthographic camera when calculating zoom speed.

  #### Parameters

  - distance: number

    Distance to change the orthographic frustum size with. Only for internal use.

  #### Returns number

  speed.

  Inherited from TwinfinityCameraExtensions.computeOrthographicZoomSpeed

### createPickingRayToRef

- createPickingRayToRef(dst: Ray, o: CanvasPosition): Ray

  Creates a ray from the camera through the screen coordinate defined by `o`. This ray is useful for pick operations.

  #### Parameters

  - dst: Ray

    Ray is written here.

  - o: CanvasPosition

    Optional. If not specified then the center of the canvas is used.

  #### Returns Ray

  Inherited from TwinfinityCameraExtensions.createPickingRayToRef

### getFrustumToRef

- getFrustumToRef(dst: FrustumPlanes): FrustumPlanes

  Gets the camera frustum planes

  #### Parameters

  - dst: FrustumPlanes

    Camera frustum planes are written

  #### Returns FrustumPlanes

  Frustum planes (same reference as `dst`)

  Inherited from TwinfinityCameraExtensions.getFrustumToRef

### getOrthoFrustumSizeToRef

- getOrthoFrustumSizeToRef(dst: Vertex2): Vertex2

  Gets the size of the orthographic frustm (defined by Camera.orthoBottom, Camera.orthoTop, Camera.orthoLeft, Camera.orthoRight).

  #### Parameters

  - dst: Vertex2

    Size is written here,. `x` is width and `y`i is height.

  #### Returns Vertex2

  `dst`.

  Inherited from TwinfinityCameraExtensions.getOrthoFrustumSizeToRef

### pick

- pick(o: PickOption): PickResult

  Performs intersection testing against objects in the scene from the cameras point of view.

  #### Parameters

  - o: PickOption

    See PickOption.

  #### Returns PickResult

  Inherited from TwinfinityCameraExtensions.pick

### setOrtho

- setOrtho(o: { distance: number } | { height: number }): void

  Sets the orthographic frustum based on either `distance` or `height`

  #### Parameters

  - o: { distance: number } | { height: number }

    Sets orthographic frustum based on either `distance` or `height`. If `height` then Camera.orthoBottom = -`height` / 2 and Camera.orthoTop is set to `height` / 2. Camera.orthoLeft and Camera.orthoRight is then calculated using the aspect ratio.- If `distance` then frustum is sized optimally so a object in center of camera at `distance` will get approx the same size as it would with the perspective camera.

  #### Returns void

  Inherited from TwinfinityCameraExtensions.setOrtho

### stateSnapshot

- stateSnapshot(): TwinfinityCameraStateSnapshot

  Gets a TwinfinityCameraStateSnapshot instance which can be used to check if a camera has changed since a previous check.

  #### Returns TwinfinityCameraStateSnapshot

  Inherited from TwinfinityCameraExtensions.stateSnapshot