PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

GetDeviceRotation

The GetDeviceRotation function returns an InputObject and a DataType/CFrame that describes the device’s current rotation vector.

This is fired with an InputObject, which has type Enum.InputType.Gyroscope (Enum/InputType), and position that shows total rotation in each local device axis.

To check if a user’s device has an enabled gyroscope, check the value of UserInputService/GyroscopeEnabled.

Since it only fires locally, it can only be used in a LocalScript.

Returns

Return Type Summary

A tuple containing two properties:

  1. The delta property describes the amount of rotation that last happened.
  2. The CFrame is the device’s current rotation relative to it’s default reference frame.

Code Samples


UserInputService:GetDeviceRotation

This example prints the current CFrame of a players device. Note that this will only work as expected if the player’s device has an enabled gyroscope.