Skip to main content

@novorender/web_app / FlightController

Class: FlightController

The flight controller mimics the behaviour of an etheral, hovering drone, allowing unconstrained movements through walls and obstacles.

Extends

Extended by

Accessors

axes

get axes(): ControllerAxes

The input axes

See

ControllerInput.axes

Returns

ControllerAxes

Inherited from

BaseController.axes

Defined in

@novorender/web_app/controller/base.ts:55


currentFlyTo

get currentFlyTo(): undefined | Orientation

The current fly-to state, if any.

Returns

undefined | Orientation

Inherited from

BaseController.currentFlyTo

Defined in

@novorender/web_app/controller/base.ts:109


fov

get fov(): number

The camera vertical field of view angle, in degrees.

set fov(value): void

Parameters

ParameterType
valuenumber

Returns

number

Defined in

@novorender/web_app/controller/flight.ts:93


generation

get generation(): number

Camera controller state generation.

Remarks

If the controller state changes, the generation count will be incremented once every call to renderStateChanges. This can be used to detect changes by comparing to a local generation count. The count is wrapped at 0xffffffff, so make sure you use != comparison and not < comparison.

Returns

number

Inherited from

BaseController.generation

Defined in

@novorender/web_app/controller/base.ts:29


hasShift

get hasShift(): boolean

The input shift button state.

See

ControllerInput.hasShift

Returns

boolean

Inherited from

BaseController.hasShift

Defined in

@novorender/web_app/controller/base.ts:104


height

get height(): number

The input element height.

See

ControllerInput.height

Returns

number

Inherited from

BaseController.height

Defined in

@novorender/web_app/controller/base.ts:76


moving

get moving(): boolean

Whether the camera is currently considered moving or not.

See

View.isIdleFrame

Returns

boolean

Inherited from

BaseController.moving

Defined in

@novorender/web_app/controller/base.ts:62


multiplier

get multiplier(): number

The input multiplier.

See

ControllerInput.multiplier

Returns

number

Inherited from

BaseController.multiplier

Defined in

@novorender/web_app/controller/base.ts:83


pitch

get pitch(): number

The camera pitch angle, in degrees.

set pitch(value): void

Parameters

ParameterType
valuenumber

Returns

number

Defined in

@novorender/web_app/controller/flight.ts:75


pivot

get pivot(): undefined | Pivot

The optional pivot point to orbit around, in world space.

Returns

undefined | Pivot

Defined in

@novorender/web_app/controller/flight.ts:102


pointerTable

get pointerTable(): readonly TouchContactPoint[]

The input pointer table.

See

ControllerInput.touchPoints

Returns

readonly TouchContactPoint[]

Inherited from

BaseController.pointerTable

Defined in

@novorender/web_app/controller/base.ts:97


position

get position(): ReadonlyVec3

Camera position, in world space.

set position(value): void

Parameters

ParameterType
valueReadonlyVec3

Returns

ReadonlyVec3

Defined in

@novorender/web_app/controller/flight.ts:58


rotation

get rotation(): ReadonlyQuat

Computed rotation quaternion, in world space.

Remarks

This rotation is derived from pitch and yaw angles.

Returns

ReadonlyQuat

Defined in

@novorender/web_app/controller/flight.ts:70


width

get width(): number

The input element width.

See

ControllerInput.width

Returns

number

Inherited from

BaseController.width

Defined in

@novorender/web_app/controller/base.ts:69


yaw

get yaw(): number

The camera yaw angle, in degrees.

set yaw(value): void

Parameters

ParameterType
valuenumber

Returns

number

Defined in

@novorender/web_app/controller/flight.ts:84


zoomPos

get zoomPos(): number[]

The input zoom position.

See

ControllerInput.zoomPos

Returns

number[]

Inherited from

BaseController.zoomPos

Defined in

@novorender/web_app/controller/base.ts:90

Constructors

new FlightController()

new FlightController(
input,
pick,
conversions): FlightController

Parameters

ParameterTypeDescription
inputControllerInputThe input source.
pickPickContextThe context used for pick queries.
conversionsScreenSpaceConversions-

Returns

FlightController

Overrides

BaseController.constructor

Defined in

@novorender/web_app/controller/flight.ts:48

Methods

animate()

animate(elapsedTime): void

Apply time sensitive changes to controller state.

Parameters

ParameterTypeDescription
elapsedTimenumberThe # of milliseconds elapsed since the last update.

Returns

void

Remarks

Fly-to animations happens here, as well as motion based on keyboard pressed-state, such as the WASD keys.

Inherited from

BaseController.animate

Defined in

@novorender/web_app/controller/base.ts:136


attach()

attach(): void

Attach this controller to the input object

Returns

void

Inherited from

BaseController.attach

Defined in

@novorender/web_app/controller/base.ts:193


autoFit()

autoFit(center, radius): void

Attempt to fit controller position such that the specified bounding sphere is brought into view.

Parameters

ParameterTypeDescription
centerReadonlyVec3The center of the bounding sphere, in world space.
radiusnumberThe radius of the bounding sphere, in world space.

Returns

void

Overrides

BaseController.autoFit

Defined in

@novorender/web_app/controller/flight.ts:140


changed()

protected changed(): void

Signal changes to internal state.

Returns

void

Inherited from

BaseController.changed

Defined in

@novorender/web_app/controller/base.ts:34


getTransformations()

protected getTransformations(): CameraTransformations

Function to get transformations since last updated. This can be overwritten to easily change direction and scale of input while keeping the standard caluculation for flight controller

Returns

CameraTransformations

Defined in

@novorender/web_app/controller/flight.ts:401


init()

init(params): void

Initialize controller from parameters.

Parameters

ParameterType
paramsControllerInitParams

Returns

void

See

serialize

Overrides

BaseController.init

Defined in

@novorender/web_app/controller/flight.ts:123


modifiers()

protected modifiers(): object

Function for getting input modifiers based on how far the 3d objects are from the mouse cursor

Returns

object

mousePanModifier
mousePanModifier: number;
mouseWheelModifier
mouseWheelModifier: number;
pinchModifier
pinchModifier: number;
scale
scale: number = 20;
touchMovementModifier
touchMovementModifier: number;

Defined in

@novorender/web_app/controller/flight.ts:375


mouseButtonChanged()

mouseButtonChanged(event): Promise<void>

Handler for mouse buttons events.

Parameters

ParameterType
eventMouseEvent

Returns

Promise<void>

Overrides

BaseController.mouseButtonChanged

Defined in

@novorender/web_app/controller/flight.ts:286


moveBegin()

moveBegin(event): Promise<void>

Handler for mouse/touch move events.

Parameters

ParameterType
eventMouseEvent | TouchEvent

Returns

Promise<void>

Overrides

BaseController.moveBegin

Defined in

@novorender/web_app/controller/flight.ts:322


moveTo()

moveTo(
targetPosition,
flyTime,
rotation?,
easeFunction?): void

Move controller to specified position/rotation.

Parameters

ParameterTypeDefault value
targetPositionReadonlyVec3undefined
flyTimenumber1000
rotation?ReadonlyQuatundefined
easeFunction?(t) => numberundefined

Returns

void

Overrides

BaseController.moveTo

Defined in

@novorender/web_app/controller/flight.ts:149


renderStateChanges()

renderStateChanges(state, elapsedTime): undefined | RecursivePartial<RenderState>

Retrieve the state changes to be applied to the specified render state.

Parameters

ParameterTypeDescription
stateRenderStateCameraThe baseline render state.
elapsedTimenumberThe time elapsed since last call, in milliseconds.

Returns

undefined | RecursivePartial<RenderState>

Inherited from

BaseController.renderStateChanges

Defined in

@novorender/web_app/controller/base.ts:236


resetFlyTo()

protected resetFlyTo(): void

Returns

void

Inherited from

BaseController.resetFlyTo

Defined in

@novorender/web_app/controller/base.ts:113


resetVelocity()

resetVelocity(): void

Returns

void

Defined in

@novorender/web_app/controller/flight.ts:106


serialize()

serialize(): ControllerInitParams

Serialize the state of this controller into init parameters.

Returns

ControllerInitParams

See

init

Overrides

BaseController.serialize

Defined in

@novorender/web_app/controller/flight.ts:117


setFlyTo()

protected setFlyTo(flyTo): void

Initialize a fly-to transition.

Parameters

ParameterTypeDescription
flyToFlyToParamsThe transition parameters

Returns

void

Inherited from

BaseController.setFlyTo

Defined in

@novorender/web_app/controller/base.ts:120


stateChanges()

stateChanges(state?): Partial<RenderStateCamera>

Retrieve changes to render state from derived class, if any.

Parameters

ParameterTypeDescription
state?RenderStateCameraThe baseline state to apply changes to.

Returns

Partial<RenderStateCamera>

See

View.modifyRenderState

Remarks

If there are no changes, the returned object will be empty, i.e. .

Overrides

BaseController.stateChanges

Defined in

@novorender/web_app/controller/flight.ts:265


touchChanged()

touchChanged(event): Promise<void>

Handler for touch events.

Parameters

ParameterType
eventTouchEvent

Returns

Promise<void>

Overrides

BaseController.touchChanged

Defined in

@novorender/web_app/controller/flight.ts:303


update()

update(): void

Update internal controller state

Returns

void

Overrides

BaseController.update

Defined in

@novorender/web_app/controller/flight.ts:197


updateParams()

updateParams(params): void

Update controller parameters.

Parameters

ParameterTypeDescription
paramsRecursivePartial<FlightControllerParams>Set of parameters to change.

Returns

void

Defined in

@novorender/web_app/controller/flight.ts:113


zoomTo()

zoomTo(boundingSphere, flyTime): void

Bring the specified bounding sphere into view.

Parameters

ParameterTypeDefault value
boundingSphereBoundingSphereundefined
flyTimenumber1000

Returns

void

Remarks

This function will retain the current camera controller rotation.

Overrides

BaseController.zoomTo

Defined in

@novorender/web_app/controller/flight.ts:177


assert()

static assert(controller): asserts controller is FlightController

FlightController type assert function.

Parameters

ParameterTypeDescription
controllerBaseControllerThe controller to type assert.

Returns

asserts controller is FlightController

Defined in

@novorender/web_app/controller/flight.ts:428


getDistanceFromViewPlane()

protected static getDistanceFromViewPlane(
point,
cameraPosition,
cameraRotation): number

Compute the distance to a point from the specified view plane.

Parameters

ParameterTypeDescription
pointReadonlyVec3The point to measure distance too
cameraPositionReadonlyVec3The position of the camera/view plane.
cameraRotationReadonlyQuatThe rotation of the camera/view plane.

Returns

number

A signed distance from the point to the view plane, i.e. positive for points in front of the plane and negative otherwise.

Inherited from

BaseController.getDistanceFromViewPlane

Defined in

@novorender/web_app/controller/base.ts:262


is()

static is(controller): controller is FlightController

FlightController type guard function.

Parameters

ParameterTypeDescription
controllerBaseControllerThe controller to type guard.

Returns

controller is FlightController

Defined in

@novorender/web_app/controller/flight.ts:421

Properties

conversions

readonly conversions: ScreenSpaceConversions;

Defined in

@novorender/web_app/controller/flight.ts:52


input

readonly input: ControllerInput;

The input source for this controller.

Inherited from

BaseController.input

Defined in

@novorender/web_app/controller/base.ts:48


kind

kind: string = "flight";

The controller type id.

Overrides

BaseController.kind

Defined in

@novorender/web_app/controller/flight.ts:20


pick

readonly pick: PickContext;

The context used for pick queries.

Defined in

@novorender/web_app/controller/flight.ts:51


pivotButton

protected pivotButton: MouseButtons = MouseButtons.right;

Can be overwritten by subclasses to change pivot button

Defined in

@novorender/web_app/controller/flight.ts:16


projection

projection: "pinhole";

The camera projection kind.

See

RenderStateCamera.kind.

Overrides

BaseController.projection

Defined in

@novorender/web_app/controller/flight.ts:21