class.FlightController
API > FlightController
Class: FlightController
The flight controller mimics the behaviour of an etheral, hovering drone, allowing unconstrained movements through walls and obstacles.
Extends
Constructors
constructor
new FlightController(
input
,pick
):FlightController
Parameters
Parameter | Type | Description |
---|---|---|
input | ControllerInput | The input source. |
pick | PickContext | The context used for pick queries. |
Returns
Overrides
Source
@novorender/web_app/controller/flight.ts:45
Properties
input
readonly
input:ControllerInput
The input source for this controller.
Inherited from
Source
@novorender/web_app/controller/base.ts:48
kind
kind:
string
="flight"
The controller type id.
Overrides
Source
@novorender/web_app/controller/flight.ts:19
pick
readonly
pick:PickContext
The context used for pick queries.
Source
@novorender/web_app/controller/flight.ts:48
projection
projection:
"pinhole"
The camera projection kind.
See
Overrides
Source
@novorender/web_app/controller/flight.ts:20
Accessors
axes
get axes():
ControllerAxes
The input axes
Returns
Inherited from
BaseController.axes
Source
@novorender/web_app/controller/base.ts:55
See
currentFlyTo
get currentFlyTo():
undefined
|Orientation
The current fly-to state, if any.
Returns
undefined
| Orientation
Inherited from
BaseController.currentFlyTo
Source
@novorender/web_app/controller/base.ts:109
fov
get set fov():
number
The camera vertical field of view angle, in degrees.
Returns
number
Source
@novorender/web_app/controller/flight.ts:89
generation
get generation():
number
Camera controller state generation.
Returns
number
Inherited from
BaseController.generation
Source
@novorender/web_app/controller/base.ts:29
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.
hasShift
get hasShift():
boolean
The input shift button state.
Returns
boolean
Inherited from
BaseController.hasShift
Source
@novorender/web_app/controller/base.ts:104
See
height
get height():
number
The input element height.
Returns
number
Inherited from
BaseController.height
Source
@novorender/web_app/controller/base.ts:76
See
moving
get moving():
boolean
Whether the camera is currently considered moving or not.
Returns
boolean
Inherited from
BaseController.moving
Source
@novorender/web_app/controller/base.ts:62
See
View.isIdleFrame
multiplier
get multiplier():
number
The input multiplier.
Returns
number
Inherited from
BaseController.multiplier
Source
@novorender/web_app/controller/base.ts:83
See
pitch
get set pitch():
number
The camera pitch angle, in degrees.
Returns
number
Source
@novorender/web_app/controller/flight.ts:71
pivot
get pivot():
undefined
|Pivot
The optional pivot point to orbit around, in world space.
Returns
undefined
| Pivot
Source
@novorender/web_app/controller/flight.ts:98
pointerTable
get pointerTable(): readonly
TouchContactPoint
[]
The input pointer table.
Returns
readonly TouchContactPoint
[]
Inherited from
BaseController.pointerTable
Source
@novorender/web_app/controller/base.ts:97
See
position
get set position():
ReadonlyVec3
Camera position, in world space.
Returns
ReadonlyVec3
Source
@novorender/web_app/controller/flight.ts:54
rotation
get rotation():
ReadonlyQuat
Computed rotation quaternion, in world space.
Returns
ReadonlyQuat
Source
@novorender/web_app/controller/flight.ts:66
Remarks
This rotation is derived from pitch and yaw angles.
width
get width():
number
The input element width.
Returns
number
Inherited from
BaseController.width
Source
@novorender/web_app/controller/base.ts:69
See
yaw
get set yaw():
number
The camera yaw angle, in degrees.
Returns
number
Source
@novorender/web_app/controller/flight.ts:80
zoomPos
get zoomPos():
number
[]
The input zoom position.
Returns
number
[]
Inherited from
BaseController.zoomPos
Source
@novorender/web_app/controller/base.ts:90
See
Methods
animate
animate(
elapsedTime
):void
Apply time sensitive changes to controller state.
Parameters
Parameter | Type | Description |
---|---|---|
elapsedTime | number | The # of milliseconds elapsed since the last update. |
Returns
void
Inherited from
Source
@novorender/web_app/controller/base.ts:132
Remarks
Fly-to animations happens here, as well as motion based on keyboard pressed-state, such as the WASD keys.
attach
attach():
void
Attach this controller to the input object
Returns
void
Inherited from
Source
@novorender/web_app/controller/base.ts:189
autoFit
autoFit(
center
,radius
):void
Attempt to fit controller position such that the specified bounding sphere is brought into view.
Parameters
Parameter | Type | Description |
---|---|---|
center | ReadonlyVec3 | The center of the bounding sphere, in world space. |
radius | number | The radius of the bounding sphere, in world space. |
Returns
void
Overrides
Source
@novorender/web_app/controller/flight.ts:132
changed
protected
changed():void
Signal changes to internal state.
Returns
void
Inherited from
Source
@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
Source
@novorender/web_app/controller/flight.ts:363
init
init(
params
):void
Initialize controller from parameters.
Parameters
Parameter | Type |
---|---|
params | ControllerInitParams |
Returns
void
Overrides
Source
@novorender/web_app/controller/flight.ts:115
See
modifiers
protected
modifiers():object
Function for getting input modifiers based on how far the 3d objects are from the mouse cursor
Returns
mousePanModifier
mousePanModifier: number
mouseWheelModifier
mouseWheelModifier: number
pinchModifier
pinchModifier: number
scale
scale: number
= 20
touchMovementModifier
touchMovementModifier: number
Source
@novorender/web_app/controller/flight.ts:337
mouseButtonChanged
mouseButtonChanged(
event
):Promise
\<void
>
Handler for mouse buttons events.
Parameters
Parameter | Type |
---|---|
event | MouseEvent |
Returns
Promise
\< void
>
Overrides
BaseController
.mouseButtonChanged
Source
@novorender/web_app/controller/flight.ts:251
moveBegin
moveBegin(
event
):Promise
\<void
>
Handler for mouse/touch move events.
Parameters
Parameter | Type |
---|---|
event | MouseEvent | TouchEvent |
Returns
Promise
\< void
>
Overrides
Source
@novorender/web_app/controller/flight.ts:284
moveTo
moveTo(
targetPosition
,flyTime
=1000
,rotation
?):void
Move controller to specified position/rotation.
Parameters
Parameter | Type | Default value |
---|---|---|
targetPosition | ReadonlyVec3 | undefined |
flyTime | number | 1000 |
rotation ? | ReadonlyQuat | undefined |
Returns
void
Overrides
Source
@novorender/web_app/controller/flight.ts:141
renderStateChanges
renderStateChanges(
state
,elapsedTime
):undefined
|RecursivePartial
\<RenderState
>
Retrieve the state changes to be applied to the specified render state.
Parameters
Parameter | Type | Description |
---|---|---|
state | RenderStateCamera | The baseline render state. |
elapsedTime | number | The time elapsed since last call, in milliseconds. |
Returns
undefined
| RecursivePartial
\< RenderState
>
Inherited from
BaseController
.renderStateChanges
Source
@novorender/web_app/controller/base.ts:232
serialize
serialize():
ControllerInitParams
Serialize the state of this controller into init parameters.
Returns
Overrides
Source
@novorender/web_app/controller/flight.ts:109
See
setFlyTo
protected
setFlyTo(flyTo
):void
Initialize a fly-to transition.
Parameters
Parameter | Type | Description |
---|---|---|
flyTo | FlyToParams | The transition parameters |
Returns
void
Inherited from
Source
@novorender/web_app/controller/base.ts:116
stateChanges
stateChanges(
state
?):Partial
\<RenderStateCamera
>
Retrieve changes to render state from derived class, if any.
Parameters
Parameter | Type | Description |
---|---|---|
state ? | RenderStateCamera | The baseline state to apply changes to. |
Returns
Partial
\< RenderStateCamera
>
Overrides
Source
@novorender/web_app/controller/flight.ts:230
See
Remarks
If there are no changes, the returned object will be empty, i.e. {}.
touchChanged
touchChanged(
event
):Promise
\<void
>
Handler for touch events.
Parameters
Parameter | Type |
---|---|
event | TouchEvent |
Returns
Promise
\< void
>
Overrides
Source
@novorender/web_app/controller/flight.ts:268
update
update():
void
Update internal controller state
Returns
void
Overrides
Source
@novorender/web_app/controller/flight.ts:187
updateParams
updateParams(
params
):void
Update controller parameters.
Parameters
Parameter | Type | Description |
---|---|---|
params | RecursivePartial \< FlightControllerParams > | Set of parameters to change. |
Returns
void
Source
@novorender/web_app/controller/flight.ts:105
zoomTo
zoomTo(
boundingSphere
,flyTime
=1000
):void
Bring the specified bounding sphere into view.
Parameters
Parameter | Type | Default value |
---|---|---|
boundingSphere | BoundingSphere | undefined |
flyTime | number | 1000 |
Returns
void
Overrides
Source
@novorender/web_app/controller/flight.ts:168
Remarks
This function will retain the current camera controller rotation.
assert
static
assert(controller
):asserts controller is FlightController
FlightController type assert function.
Parameters
Parameter | Type | Description |
---|---|---|
controller | BaseController | The controller to type assert. |
Returns
asserts controller is FlightController
Source
@novorender/web_app/controller/flight.ts:390
getDistanceFromViewPlane
static
protected
getDistanceFromViewPlane(point
,cameraPosition
,cameraRotation
):number
Compute the distance to a point from the specified view plane.
Parameters
Parameter | Type | Description |
---|---|---|
point | ReadonlyVec3 | The point to measure distance too |
cameraPosition | ReadonlyVec3 | The position of the camera/view plane. |
cameraRotation | ReadonlyQuat | The 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
Source
@novorender/web_app/controller/base.ts:258
is
static
is(controller
):controller is FlightController
FlightController type guard function.
Parameters
Parameter | Type | Description |
---|---|---|
controller | BaseController | The controller to type guard. |
Returns
controller is FlightController