iPhone Rotation (compensation)

Hey there…

I am trying to create a control where my ‘car’ turns right/left when I rotate my iPhone right/left.
But this should work when the user is playing the game standing and also when he is laying in bed.

Well, the problem is… when I get my iPhoneInput.acceleration.y it gets the rotation value, but this only works if my iphone is standing 90 degrees from the ground.
If I have my iphone parallel to the ground the rotation value that I need to use to control the car’s direction is not y anymore.

Is there anyone else who is facing the same problem?
If you had in the past, how could you solve this compensation when it comes to iphone rotation?

Well guys, thats it… thanks in advance!

:slight_smile:
cya

With the device parallel to the ground there is no way to still achieve a tilt control around the z axis. However, you can still use the y reading but the player will simply have to dip the phone to the right or left.

Of course, if the player is on their back then the y value will need to be reversed (so that right still turns right and left is still left).