Orientation Sensor¶
Non-Visible componentCategory | Requires | Version |
---|---|---|
Sensors | API 21, Android 5.0 Lollipop | 2 |
Overview¶
Non-visible component providing information about the device's physical orientation in three dimensions:
- Roll: 0 degrees when the device is level, increases to 90 degrees as the device is tilted up on its left side, and decreases to -90 degrees when the device is tilted up on its right side.
- Pitch: 0 degrees when the device is level, up to 90 degrees as the device is tilted so its top is pointing down, up to 180 degrees as it gets turned over. Similarly, as the device is tilted so its bottom points down, pitch decreases to -90 degrees, then further decreases to -180 degrees as it gets turned all the way over.
- Azimuth: 0 degrees when the top of the device is pointing north, 90 degrees when it is pointing east, 180 degrees when it is pointing south, 270 degrees when it is pointing west, etc.
These measurements assume that the device itself is not moving.
Events¶
Orientation Changed¶
Default OrientationChanged event handler
This event is signalled when the device's orientation has changed. Itreports the new values of azimuth, pich, and roll, and it also sets the Azimuth, Pitch,and roll properties.
Azimuth is the compass heading in degrees, pitch indicates how the deviceis tilted from top to bottom, and roll indicates how much the device is tilted fromside to side.
Params | |
---|---|
azimuth | Number |
pitch | Number |
roll | Number |
Properties¶
Angle¶
Number Read - Blocks
Angle property getter method (read-only property). Specifically, thisprovides the angle in which the orientation sensor is tilted, treating
Available¶
Boolean Read - Blocks
Available property getter method (read-only property).
Azimuth¶
Number Read - Blocks
Azimuth property getter method (read-only property)
To return meaningful values the sensor must be enabled.
Enabled¶
Boolean Default: True Read Write - Designer Blocks
Enabled property getter method.
Magnitude¶
Number Read - Blocks
Magnitude property getter method (read-only property). Specifically, thisreturns a number between 0 and 1, indicating how much the deviceis tilted. For the angle of tilt, use
Pitch¶
Number Read - Blocks
Pitch property getter method (read-only property)
To return meaningful values the sensor must be enabled.
Roll¶
Number Read - Blocks
Roll property getter method (read-only property)
To return meaningful values the sensor must be enabled.