Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hbollon/gyroscopecontrol
🌀 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.
https://github.com/hbollon/gyroscopecontrol
android csharp gyroscope physics rotation unity unity-android unity-gyroscope unity-script unity3d unity3d-script
Last synced: 3 months ago
JSON representation
🌀 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.
- Host: GitHub
- URL: https://github.com/hbollon/gyroscopecontrol
- Owner: hbollon
- License: mit
- Created: 2020-04-20T16:22:25.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-08-26T20:50:21.000Z (over 4 years ago)
- Last Synced: 2024-10-10T10:24:22.103Z (3 months ago)
- Topics: android, csharp, gyroscope, physics, rotation, unity, unity-android, unity-gyroscope, unity-script, unity3d, unity3d-script
- Language: C#
- Homepage:
- Size: 16.6 KB
- Stars: 29
- Watchers: 4
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
GyroscopeControl : Unity script for object rotation on mobile devices with gyroscope
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 includes initial calibration with offset, rotation speed (Time.deltaTime * velocity), smoothing parameter editable in Unity inspector and debug overlay.This script has been designed to be easily customizable and to obtain the smoothest and most flexible rotation possible.
Tested on Android.## Edit rotation axis
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 :```C#
Quaternion tempGyroRotation = new Quaternion(
offsetRotation.x * curSpeed,
0f * curSpeed,
offsetRotation.y * curSpeed,
offsetRotation.w * curSpeed
);
```
## Settings
This script contain few parameters editable through Unity inspector :
* Speed : change rotation speed of the object
* Smoothing : must be between 0 and 1, it changes the delay for the object in order to reach its final position
* Wait Gyro Initialization : used to enable or disable the initial delay to wait gyroscope activation
* Wait Gyro Initialization Duration : duration of the initial delay in seconds
* Debug : displays an overlay which includes a lot of information such as: real-time gyro attitude, offset, initial position ect...## 🤝 Contributing
Contributions, issues and feature requests are welcome!
Feel free to check [issues page](https://github.com/hbollon/GyroscopeControl/issues).## Show your support
Give a ⭐️ if this project helped you!