API Documentation

for 0.0.1
Show:

Orientation Class

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.

Constructor

Orientation

()

Methods

byPass TODO!

()

chain

(
  • component
)
Adds a component to this chained component array

Parameters:

compassCalibrationHandler

(
  • event
)
private

compass calibration event callback

Parameters:

  • event Object

createGyroQuaternion

(
  • alpha
  • beta
  • gamma
  • screenOrientation
)
private

Creates a Quaternion that matches the device's current orientation. Calculated in radians.

Parameters:

  • alpha Number

    the angle to use for the quaternion creation

  • beta Number

    the angle to use for the quaternion creation

  • gamma Number

    the angle to use for the quaternion creation

  • screenOrientation Object

    orientation of the screen in degree! Can be very different depending on the plateform...

getChainedComponents

() Array
Returns the array of attached children components

Returns:

Array: children arrays

getContext

() Context

Inherited from Base but overwritten in src/js/Mobilizing/Base.js:37

Get the Mobilizing context

Returns:

Context: The Mobilizing context

getDeviceOrientation

() Object

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

Returns:

Object:

compass object with x, y & z components

getGyroQuaternion

()

Can be used in the transform of a perspective camera to produce a "blind camera" effect : move the screen around to frame a part of the current scene like if you were using a camera.

getID

() Int
Get the Object unique ID

Returns:

Int: The Object ID

getStatus

() Boolean
Get the activation status of the component

Returns:

Boolean: True if active, false otherwise

off

()
Deactivate the component

on

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

onDeviceorientation

(
  • event
)
private

callback used to access compass event.

Parameters:

  • event Object

postUpdate

()
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

preLoad

()
preLoad the component This empty method is usually overriden to perform setup actions for the component. The preLoad is designed to be called before any other method, even setup. In the case of user scripts, it is used to preload all needed datas before the setup (pictures, font, etc.) It is called automatically by an internal Mobilizing mechanism and should thus not be called directly

preUpdate

()
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

runSetup

()
Calls the setup if it has not already been called This method should not be called 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

setContext

(
  • context
)
Set the Mobilizing context

Parameters:

  • context Context
    The Mobilizing Context

setName

(
  • name
)
Set the Object name

Parameters:

  • name String
    The Object name

setup

()
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

update

()
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

Properties

_active

Boolean private
Whether the component is active or not

_compassAvailable

Boolean

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

_context

Context private
A reference to the Mobilizing context

_setupDone

Boolean private
Whether the component's setup has been called

events

EventEmitter
An event emmiter used to send custom events

Events

compassneedscalibration

Fired when calibration is required

deviceorientation

Fired when a new orientation is available