Advertisement
Guest User

Untitled

a guest
Apr 27th, 2015
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. #pragma strict
  2.  
  3. private var quatMult : Quaternion;
  4. private var quatMap : Quaternion;
  5.  
  6. function Start () {
  7. // Adjust the rotation based on how the phone is being held
  8. // NOTE: in FOV2GO this is in the Awake() script
  9. Input.gyro.enabled = true;
  10. }
  11.  
  12. function Update () {
  13.  
  14. #if UNITY_ANDROID
  15. quatMap = Input.gyro.attitude;
  16. #endif
  17.  
  18. transform.localRotation = Quaternion.Euler(90, 0, 0) * quatMap * Quaternion(0,0,1,0) /*quatMult*/;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement