Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

How do you reset the gyro attitude?

Discussion in 'iOS and tvOS' started by monark, Oct 10, 2011.

  1. monark

    monark

    Joined:
    May 2, 2008
    Posts:
    1,595
    I've noticed that if I just print Input.gyro.attitude to the screen that the values I get out differ depending on the orientation the app starts in. If I start in portrait mode and then rotate the device into landscape the quaternion returned is different to if I start in landscape mode. Is there a way to reset the gyro when the device is rotated to a new orientation so it's the same as if you start in that orientation?

    To explain a bit further:
    If I start in portrait mode and tilt the device forward and back the x axis amount of the quaternion changes as expected and side to side changes the y axis amount.
    If I then swap without restarting into landscape mode tilting back and forth changes both the x and y axis amounts.
    If I restart in landscape tilting back and forth changes the y axis amount and side to side changes the x axis amount so it's consistent although not in relationship to the device itself (that could be compensated for)
     
  2. Mantas-Puida

    Mantas-Puida

    Unity Technologies

    Joined:
    Nov 13, 2008
    Posts:
    1,864
    You can try to restart gyroscope by setting Gyroscope.enabled to false and then again setting it to true.
     
  3. charmandermon

    charmandermon

    Joined:
    Dec 4, 2011
    Posts:
    352
    This no longer works in 4.0.1f2
     
  4. minevr

    minevr

    Joined:
    Mar 4, 2008
    Posts:
    1,018
    if set enabled false,again "true"....gyro is dead.....

    on unity last ver.
     
  5. Mantas-Puida

    Mantas-Puida

    Unity Technologies

    Joined:
    Nov 13, 2008
    Posts:
    1,864
    It is known bug, the fix will be included into next Unity release.
     
  6. JackJick

    JackJick

    Joined:
    Jun 24, 2013
    Posts:
    8
    is it fixed?
     
  7. GaneshDeveloper

    GaneshDeveloper

    Joined:
    Feb 14, 2014
    Posts:
    4
    i want to reset the my gyro how i am holding the device.so my gyro initial state is how i am holding the device from this it should start calibrate.how can i achieve this one?
     
  8. juuuuun

    juuuuun

    Joined:
    Feb 17, 2014
    Posts:
    23
    I think it's still not fixed yet. I cannot reset the attitude of gyro even if I tried setting the Input.gyro.enabled = false and set it true again. Is there any other way to reset the attitude?