Sfoglia il codice sorgente

Fixed Platform::getAccelerometerValues() for Android.

Darryl Gough 13 anni fa
parent
commit
a4cf36f65b
1 ha cambiato i file con 2 aggiunte e 2 eliminazioni
  1. 2 2
      gameplay/src/PlatformAndroid.cpp

+ 2 - 2
gameplay/src/PlatformAndroid.cpp

@@ -835,9 +835,9 @@ void Platform::getAccelerometerValues(float* pitch, float* roll)
     tz = -__sensorEvent.acceleration.z;
     
     if (pitch != NULL)
-        *pitch = atan(ty / sqrt(tx * tx + tz * tz)) * 180.0f * M_1_PI;
+        *pitch = -atan(ty / sqrt(tx * tx + tz * tz)) * 180.0f * M_1_PI;
     if (roll != NULL)
-        *roll = atan(tx / sqrt(ty * ty + tz * tz)) * 180.0f * M_1_PI;
+        *roll = -atan(tx / sqrt(ty * ty + tz * tz)) * 180.0f * M_1_PI;
 }
 
 void Platform::swapBuffers()