Orientation

  • Description

      Orientation

      The orientation sensor is a non visible component which allows to determine the spatial orientation of the device. This sensor informs of the following values:

      • - Roll: this value is obtained from the rotation of the device. These would be the values for:
        • 0,when the mobile device is level.
        • Towards 90, when the device is rotated to the left.
        • Towards -90, when the device is rotated to the right.
      • - Pitch: this value is obtained from the inclination of the device. These would be the values for:
        • 0, when the mobile device is level.
        • Towards 90, when the device is tilted forward.
        • Towards -90, when the device is tilted backwards.
      • - Azimuth: this value is obtained in function of the orientation of the device with respect to the north magnetic (azimuthal). These would be the values for face point :
        • 0, when the top of the disposistivo points towards the north.
        • 90, when the top of the disposistivo points towards the east.
        • 180, when the top of the disposistivo points towards the south.
        • 270, when the top of the disposistivo points to the west.
  • Events

    • Orientation Changed
    • Event that is executed when it is detected that the orientation of the device is changed.
  • Properties

    • Available (boolean)
    • Allows you to determine if the device has the orientation sensor or not, if it is 'True' the device will have.
    • Enabled (boolean)
    • Allows you to set or get if the orientation sensor of the device is activated or not.
    • Pitch (decimal number)
    • This property returns the tilt angle of the device.
    • Roll (decimal number)
    • This property returns the angle of swing of the device.
    • Azimuth (decimal number)
    • This property returns the azimuth angle of the device.
    • Magnitude (number)
    • This property returns a number between 0 and 1 that indicates how much is by tilting the device. Given the magnitude of the force that would be a ball rolling on the surface of the device.
    • Angle (number)
    • This property returns an angle that indicates the direction in which is mosaic the device. That is to say, indicates the direction of the force that would be a ball rolling on the surface of the device.
  • Example

    • Obtaining the values of orientation
    • When there is a change of orientation, the sensor of the device it will detect and activate the event 'Orientation Changed'. This event will provide us the values of 'Roll'. 'Pitch' and 'Azimuth' which is displayed on the screen.