Repository
public class |source

Orientation

Extends:

Component → Orientation

Uses built-in compass and/or gyroscope to produce orientation Data. Some heplers functions are in there to generate quarternion that can be applied on a camera or a 3D object's transform. !WARNING! On iOS 13+ you must call on() in a user interaction (i.e "click" or equivalent). See examples!

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public

true if the magnetometer/compass is available on the device, false otherwise

public

The compass/gyro current raw values.

public
Private Members
private

Method Summary

Public Methods
public

getRotationMatrix(alpha: Number, beta: Number, gamma: Number): undefined[]

public

off()

public

on()

public

Reset the horizontal rotation to make a kind of realtime recalibration of the rotation

public
Private Methods
private

compass calibration event callback

private

callback used to access compass event.

Inherited Summary

From class Component
public
public
public

events: *

public

id: *

public

name: *

private

_nexts: *[]

private
public
public

chain(component: Component)

Adds a component to this chained component array

public

Returns the array of attached children components

public

off()

Deactivate the component

public

on()

Activate the component A call to this method calls the setup method if it has not been run yet

public

Run code after the update of all components is run This empty method is usually overriden to perform post-update actions for the component It is called periodically by an internal Mobilizing mechanism

public

preLoad the component This empty method is usually overriden to perform preLoad actions for the component.

public

Run code before the update of all components is run This empty method is usually overriden to perform pre-update actions for the component It is called once per component by an internal Mobilizing mechanism

public

prepare the component This empty method is usually overriden to perform preparation actions for the component, from external process as a server.

public

Set's up the component This empty method is usually overriden to perform setup actions for the component This is where all the initialization (such as adding event listeners)should be done It is called automatically by an internal Mobilizing mechanism and should thus not be called directly

public

Update the component This empty method is usually overriden to perform update actions for the component It is called periodically by an internal Mobilizing mechanism

Public Constructors

public constructor() source

Override:

Component#constructor

Public Members

public available: * source

true if the magnetometer/compass is available on the device, false otherwise

public compass: Object source

The compass/gyro current raw values. This can also be get with the onDeviceOrientation event from the user script.

Properties:

NameTypeAttributeDescription
alpha*
gamma*
beta*
heading*

public rotationMatrix: *[] source

Private Members

private _baseHeading: number source

Public Methods

public getRotationMatrix(alpha: Number, beta: Number, gamma: Number): undefined[] source

©https://www.w3.org/TR/orientation-event/

Params:

NameTypeAttributeDescription
alphaNumber
betaNumber
gammaNumber

Return:

undefined[]

public off() source

Deactivate the component

Override:

Component#off

public on() source

Activate the component A call to this method calls the setup method if it has not been run yet

Override:

Component#on

public resetDirection() source

Reset the horizontal rotation to make a kind of realtime recalibration of the rotation

public setup() source

Set's up the component This empty method is usually overriden to perform setup actions for the component This is where all the initialization (such as adding event listeners)should be done It is called automatically by an internal Mobilizing mechanism and should thus not be called directly

Override:

Component#setup

Private Methods

private onCompassCalibration(event: Object) source

compass calibration event callback

Params:

NameTypeAttributeDescription
eventObject

private onDeviceOrientation(event: Object) source

callback used to access compass event.

Params:

NameTypeAttributeDescription
eventObject