Advertisement
obernardovieira

[Unity3D] Gyroscope Input (basic)

Mar 21st, 2014
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #pragma strict
  2.  
  3. var gyroBool : boolean;
  4. var gyrodev : Gyroscope;
  5.  
  6. function Start () {
  7.     gyroBool = SystemInfo.supportsGyroscope;
  8.    
  9.     if(gyroBool) {
  10.         gyrodev = Input.gyro;
  11.         gyrodev.enabled = true;
  12.     }
  13.    
  14.     Debug.Log(gyroBool.ToString());
  15. }
  16.  
  17. function Update () {
  18.     Debug.Log(gyrodev.attitude);
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement