Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
gdevelop5:all-features:device-sensors [2018/08/21 21:21]
4ian [Actions]
gdevelop5:all-features:device-sensors [2020/12/26 13:56] (current)
Line 1: Line 1:
 ====== Device sensors Extension ====== ====== Device sensors Extension ======
-This extension gives access to the sensors which can be found in most mobile devices.+This powerful extension gives you access to the sensors that can be found in most mobile devices.
  
 ===== Orientation sensor ===== ===== Orientation sensor =====
-The orientation sensor combines the gyroscope, accellerometer and compass in one sensor. This allows you to control game objects by slightly rotating the mobile device in your hands.+The orientation sensor combines the gyroscope, accelerometer and compass in one sensor. This allows you to control game objects by slightly rotating the mobile device in your hands.
 You can access the location data via the "alpha", "beta" and "gamma" values which are explained in the next section. You can access the location data via the "alpha", "beta" and "gamma" values which are explained in the next section.
  
Line 31: Line 31:
 **Sensor Active** **Sensor Active**
  
-This condition checks wether the sensor has been activated yet and is delivering location data.+This condition checks whether the sensor has been activated yet and is delivering location data.
  
 **Orientation Alpha** **Orientation Alpha**
Line 49: Line 49:
  
 This action activates the orientation sensor so that it begins to deliver alpha, beta and gamma values. This action activates the orientation sensor so that it begins to deliver alpha, beta and gamma values.
-Turn this off again when you no longer need the sensor to save some processing time and phone battery.+Turn this off when you no longer need the sensor to save some processing time and phone battery.
  
 **Deactivate Orientation Sensor** **Deactivate Orientation Sensor**
Line 57: Line 57:
  
 ==== Expressions ==== ==== Expressions ====
 +
 +**Is Absolute**
 +
 +This value indicates that the orientation data is in absolute values. In reference to the Earth's coordinates (value 1) or using an arbitrary frame, is determined by the device (value 0).
 +
 +**Alpha Value**
 +
 +The "alpha" rotation.
 +
 +**Beta Value**
 +
 +The "beta" rotation.
 +
 +**Gamma Value**
 +
 +The "gamma" rotation.
 +
 +===== Motion sensor =====
 +In contrast to the orientation sensor which returns absolute values, the motion sensor delivers relative ones.
 +This sensor only returns values while the device is moving. If you hold it still, no matter its orientation, the sensor will return 0.
 +You can access the motion data along an axis via the "x", "y", "z" values and the rotation data around an axis via "alpha", "beta" and "gamma" which are explained in the next section.
 +
 +<note>The motion sensor rotation values (alpha, beta, gamma) are currently badly supported on mobile devices. It would currently be better to calculate the value from the orientation data</note>
 +
 +==== Axes explained ====
 +===Acceleration X===
 +{{:gdevelop5:all-features:motion_acceleration_x.png?nolink|}}
 +
 +This value shows the acceleration along the x-axis. If you move your device along the longer edge, the x value will increase.
 +
 +===Acceleration Y===
 +{{:gdevelop5:all-features:motion_acceleration_y.png?nolink|}}
 +
 +This value shows the acceleration along the y-axis. If you move your device along the smaller edge, the y value will increase.
 +
 +===Acceleration Z===
 +{{:gdevelop5:all-features:motion_acceleration_z.png?nolink|}}
 +
 +This value shows the acceleration along the z-axis. If you move your device up or down, the z value will increase.
 +
 +===Rotation alpha===
 +{{:gdevelop5:all-features:motion_alpha.png?nolink|}}
 +
 +This value shows the acceleration around the z-axis. If you turn your device with the display pointing up, the alpha value will increase.
 +
 +===Rotation beta===
 +{{:gdevelop5:all-features:motion_beta.png?nolink|}}
 +
 +This value shows the acceleration around the x-axis. If you hold your device in landscape mode with a hand on each side, you can turn your device around the x-axis and the beta value will increase.
 +
 +===Rotation gamma===
 +{{:gdevelop5:all-features:motion_gamma.png?nolink|}}
 +
 +This value shows the acceleration around the y-axis. If you hold your device in portrait mode with a hand on each side, you can turn your device around the y-axis and the beta value will increase.
 +
 +==== Conditions ====
  
 **Sensor Active** **Sensor Active**
  
-Same as the condition but lets you write the active state into a variable.+This condition checks whether the sensor has been activated yet and is delivering location data.
  
-**Is Absolute**+**Acceleration X**
  
-This value indicates if the orientation data are absolute values, in reference to the Earth's coordinates (value 1) or using an arbitary frame which is determined by the device (value 0).+This condition lets you compare the value of x-acceleration to a number or variable. (m/s²) 
 + 
 +**Acceleration Y** 
 + 
 +This condition lets you compare the value of y-acceleration to a number or variable. (m/s²) 
 + 
 +**Acceleration Z** 
 + 
 +This condition lets you compare the value of z-acceleration to a number or variable. (m/s²) 
 + 
 +**Motion Alpha** 
 + 
 +This condition lets you compare the value of alpha to a number or variable. (m/s²) 
 + 
 +**Motion Beta** 
 + 
 +This condition lets you compare the value of beta to a number or variable. (m/s²) 
 + 
 +**Motion Gamma** 
 + 
 +This condition lets you compare the value of gamma to a number or variable. (m/s²) 
 + 
 +==== Actions ==== 
 + 
 +**Activate Motion Sensor** 
 + 
 +This action activates the motion sensor so that it begins to deliver x, y, z, alpha, beta and gamma values. 
 +Turn this off again when you no longer need the sensor to save some processing time and phone battery. 
 + 
 +**Deactivate Motion Sensor** 
 + 
 +This action deactivates the motion sensor so that it stops delivering x, y, z, alpha, beta and gamma values. 
 + 
 +==== Expressions ==== 
 + 
 + 
 +**Acceleration X Value** 
 + 
 +The "x" acceleration. (m/s²) 
 + 
 +**Acceleration Y Value** 
 + 
 +The "y" acceleration. (m/s²) 
 + 
 +**Acceleration Z Value** 
 + 
 +The "z" acceleration. (m/s²)
  
 **Alpha Value** **Alpha Value**
  
-The "alpha" rotation, rounded to a whole number.+The "alpha" rotation. (m/s²)
  
 **Beta Value** **Beta Value**
  
-The "beta" rotation, rounded to a whole number.+The "beta" rotation. (m/s²)
  
 **Gamma Value** **Gamma Value**
  
-The "gamma" rotation, rounded to a whole number.+The "gamma" rotation. (m/s²) 
 + 
 +{{ :gdevelop5:all-features:devicesensorsevents.png |}}