Add mobile sensors tutorial (WIP)#12089
Conversation
Cykyrios
left a comment
There was a problem hiding this comment.
Just a few formatting remarks and a pitch/roll inversion.
The last code example mentions detecting opposite "movement", when in reality the sequence of events is acceleration in one direction -> maybe no acceleration for a short while -> acceleration ~opposite to initial acceleration -> device comes to a stop. The device has technically been moving in a single direction the entire time, but I understand you mean to say the reported value shows the deceleration as that "opposite movement".
| - the X value of the gyroscope data shows the rotation around the X axis (roll). | ||
| - the Y value of the gyroscope data shows the rotation around the Y axis (yaw). | ||
| - the Z value of the gyroscope data shows the rotation around the Z axis (pitch). |
There was a problem hiding this comment.
| - the X value of the gyroscope data shows the rotation around the X axis (roll). | |
| - the Y value of the gyroscope data shows the rotation around the Y axis (yaw). | |
| - the Z value of the gyroscope data shows the rotation around the Z axis (pitch). | |
| - the X value of the gyroscope data shows the rotation around the X axis (pitch). | |
| - the Y value of the gyroscope data shows the rotation around the Y axis (yaw). | |
| - the Z value of the gyroscope data shows the rotation around the Z axis (roll). |
| .. note:: | ||
| For Android, |
There was a problem hiding this comment.
| .. note:: | |
| For Android, | |
| .. note:: | |
| On Android, |
| .. warning:: | ||
|
|
||
| Do not use accelerometer data to find the controller's position in 3D space; | ||
| the accelerometers in general are not precise enough for this. |
There was a problem hiding this comment.
| the accelerometers in general are not precise enough for this. | |
| accelerometers in general are not precise enough for this. |
| .. note:: | ||
| For Android, |
There was a problem hiding this comment.
| .. note:: | |
| For Android, | |
| .. note:: | |
| On Android, |
| .. note:: | ||
|
|
||
| Controller motion sensors usage is explained in detail | ||
| on the :ref:`doc_controller_features_motion_sensors` page. | ||
| This page describes how to use the sensors found in mobile phones on Android and iOS. |
There was a problem hiding this comment.
There should be a similar note on the Controller motion sensors section of that page, pointing to this page.
| Magnetometer | ||
| ~~~~~~~~~~~~~ |
There was a problem hiding this comment.
| Magnetometer | |
| ~~~~~~~~~~~~~ | |
| Magnetometer | |
| ~~~~~~~~~~~~ |
| With motion controls, games can track the device's physical rotation and movement. | ||
| This can be used to let the player turn the in-game camera by moving their device, or shaking their device to perform a special action. | ||
|
|
||
| The device in this case can be either a mobile phone or a controller. |
There was a problem hiding this comment.
This seems to imply this applies to controllers, but below it says phones only?
| ~~~~~~~~~~~~~~~~ | ||
|
|
||
| Mobile sensor input methods, such as :ref:`Input.get_gyroscope()<class_Input_method_get_gyroscope>`, | ||
| return :ref:`Vector3<class_Vector3>`, which corresponds to X, Y, and Z axes of the reported data, |
There was a problem hiding this comment.
| return :ref:`Vector3<class_Vector3>`, which corresponds to X, Y, and Z axes of the reported data, | |
| return :ref:`Vector3<class_Vector3>`, which corresponds to the X, Y, and Z axes of the reported data, |
| For Android, | ||
| :ref:`input_devices/sensors/enable_accelerometer<class_ProjectSettings_property_input_devices/sensors/enable_accelerometer>` | ||
| and :ref:`input_devices/sensors/enable_gravity<class_ProjectSettings_property_input_devices/sensors/enable_gravity>` | ||
| must be enabled for the accelerometer and the gravity sensors respectively to start reporting values. |
There was a problem hiding this comment.
| must be enabled for the accelerometer and the gravity sensors respectively to start reporting values. | |
| must be enabled for the accelerometer and gravity sensors respectively to start reporting values. |
|
|
||
| The following example rotates an object using the mobile device's gyroscope sensor. | ||
|
|
||
| .. code-block:: |
There was a problem hiding this comment.
| .. code-block:: | |
| .. code-block:: gdscript |
For all
This PR adds a mobile sensors tutorial. The mobile sensors include motion sensors (accelerometer and gyroscope), as well as the magnetometer sensor.
I'm creating this PR now so I won't forget about it in the future :D