🌀 Unity script used for smooth and customizable object rotation with gyroscope (initially configured to rotate x and z axis using x and y axis of gyro but can be easily edited). It include initial calibration with offset, rotation speed (Time.deltaTime * velocity), smoothing parameter editable in Unity inspector and debug overlay.
MIT License
This script has been designed to be easily customizable and to obtain the smoothest and most flexible rotation possible. Tested on Android.
In order to personalize this script to match with your case, you just have to change which gyroscope axis control which object one. To do that, you have to edit the ApplyGyroRotation function :
Quaternion tempGyroRotation = new Quaternion(
offsetRotation.x * curSpeed,
0f * curSpeed,
offsetRotation.y * curSpeed,
offsetRotation.w * curSpeed
);
This script contain few parameters editable through Unity inspector :
Contributions, issues and feature requests are welcome!Feel free to check issues page.
Give a ⭐️ if this project helped you!