# Gyroscope

The Gyroscope Actions are designed for Movement or Camera control. They cannot be used simultaneously. The component will test for a Gyroscope (more precise) being present on the device, and if not, it will automatically use the Accelerometer (which 90% of phones include). This module has three Actions:

| Action Name                  | Description                                                     |
| ---------------------------- | --------------------------------------------------------------- |
| **Set Adv Gyro Camera**      | This Action controls the Adventure Camera from the Gyroscope    |
| **Set Fps Gyro Camera**      | This Action controls the First Person Camera from the Gyroscope |
| **Set Gyro Touchstick**      | This controls the Player Movement from the Gyroscope.           |
| **Hide Gyro Touchstick**     | Enables/Disables the Gyro Touchstick                            |
| **Disable Adv  Gyro Camera** | Enables/Disables the Gyro Adventure Camera                      |
| **Disable Fps  Gyro Camera** | Enables/Disables the Gyro First Person Camera                   |

{% hint style="info" %}
Note: If the Device does not have a Gyroscope, these Actions will utilise the Accelerometer.
{% endhint %}

### Movement from Gyroscope

As with other Touchsticks for Movement, when using the Gyro Touchstick, the Prefab must be added to the Game Creator Preferences Panel.&#x20;

![](https://1680659799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LauqCzuMnmk33t__Yp5%2F-MQr-kiS5ipua_qnP2fY%2F-MQr0Y4yMItqcboWiyWt%2FScreenshot%202021-01-12%20153525.png?alt=media\&token=db6ce3a6-b77f-4598-9e2d-a7bebe02c595)

Once this is done, the Set Gyro Touchstick Action can be called, usually from an On Start Trigger.&#x20;

![](https://1680659799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LauqCzuMnmk33t__Yp5%2F-MQr-kiS5ipua_qnP2fY%2F-MQr1-qjdVsk0gCj5Ydv%2FScreenshot%202021-01-12%20153733.png?alt=media\&token=8e912329-0c41-49a4-b954-91f0212892d8)

This Actions has several options to set depending on your requirements.

| Option Name                | Description                                                                                                                                                |
| -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Activate Gyro Movement** | This tells GC to use the Gyroscope or not.                                                                                                                 |
| **Track x Axis**           | The x Axis is for moving left and right                                                                                                                    |
| **Track y Axis**           | The y Axis is for moving forward and back                                                                                                                  |
| **Horizontal is Zero**     | <p>If this is set, no movement will happen if the device is flat on the desk, </p><p>otherwise the zero point is set when the device is at 45 degrees.</p> |
| **Invert Axis**            | When set, this will reverse the angles, left for right, down for up, etc.                                                                                  |
| **Movement Speed**         | The movement speed is a Multiplier for the Gyroscope sensitivity.                                                                                          |

To disable and enable the Gyroscope touchstick, use the Hide Gyro Touchstick Action. This will toggle the Activate setting of the Touchstick.

![](https://1680659799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LauqCzuMnmk33t__Yp5%2F-MQr-kiS5ipua_qnP2fY%2F-MQr2qN05IcEVej3aZXG%2FScreenshot%202021-01-12%20154509.png?alt=media\&token=2ee4e36f-04e8-4b6a-b376-bedb261d7626)

### Camera from Gyroscope

The Gyro Camera would normally be used in conjunction with a Static Touchstick, but this is no mandatory. Please note that these Actions only controls the Game Creator Camera Motors (Adventure and First Person) and are not intended to be used as a VR Camera would be.

![](https://1680659799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LauqCzuMnmk33t__Yp5%2F-MQv4RC8JsRL_D3gssO5%2F-MQv6UWctt9lfJatsPyK%2FScreenshot%202021-01-13%20103958.png?alt=media\&token=c52ddd79-d318-4872-8a18-52b2d3c5779a)

The Camera Actions are similar to the Movement Actions, however there is one Action for the Adventure Camera Motor and a separate one for the First Person. Unless the Camera Motor is the Main Camera, you must add the Camera Motor to the Action. The Player should also be added, but this mat change in future versions.

The Camera Sensitivity should be set for the required camera tracking, and this can also be set from a GC Variable. The other Parameters are the same as for Movement.

| Option Name              | Description                                                                                                                                                |
| ------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Activate Gyro Camera** | This tells GC to use the Gyroscope or not.                                                                                                                 |
| **Track x Axis**         | The x Axis is for moving left and right                                                                                                                    |
| **Track y Axis**         | The y Axis is for moving forward and back                                                                                                                  |
| **Horizontal is Zero**   | <p>If this is set, no movement will happen if the device is flat on the desk, </p><p>otherwise the zero point is set when the device is at 45 degrees.</p> |
| **Invert Axis**          | When set, this will reverse the angles, left for right, down for up, etc.                                                                                  |

To disable and enable the Gyroscope Camera, use the Enable/Disable Gyro Camera Action. This will toggle the Activate setting of the Camera, but unlike the Movement Action, you must also add the Action that Set the Gyro Camera.

![](https://1680659799-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LauqCzuMnmk33t__Yp5%2F-MQv4RC8JsRL_D3gssO5%2F-MQv86Z-ff4JQEdoYMjc%2FScreenshot%202021-01-13%20104706.png?alt=media\&token=11d9ecfb-c5bd-4cfe-8f31-9ef29dcc69d6)

\
For more information on Gyro TouchStick Actions, see[ Example 6 - Gyro Controls](../examples/example-6-gyroscope-controls), and for details on the use of the Gyro Camera see [Example 7 - Gyro Camera.](../examples/example-7-gyroscope-camera)
