Accelerometer - Reversed Gravity When Upside Down?
rainwaterstudios
Member Posts: 198
I'm having a problem with using the Accelerometer; When the device orientation is is left landscape mode, the Accelerometer works normally (i.e. tilt the device to the left and it accelerates left), but if I rotate the device 180 degrees (making the device orientation right landscape) the actors accelerate in the direction opposite to the way the device is tilted...
Has anyone dealt with this before or have a fix? @Socks @Guru
Comments
@rainwaterstudios -- you can determine which way is 'down' by using the formula:
vectorToAngle(game.Accelerometer.X,game.Accelerometer.Y)
Thanks for the tip, could you elaborate? Where would the vectorToAngle function be implemented?
@rainwaterstudios said:
I guess I would need to know more about what you are trying to do.
You can also test for device orientation:
game.Screen.Device Orientation
I believe it returns 1,2,3, or 4 for the different orientations.