I would like to use the accelerometer to move my player sprite.
If the sprite is going straight and the player tilts a little to the left, the sprite should rotate a little bit to the left, and same for the right.
I also want to detect how much the player has tilted the device and turn the sprite accordingly.
e.g. If the player tilts the device a lot the sprite should rotate 90 degrees rather than 45 for a quick tilt in a direction.
How does one do this. Detect the device movement in any direction, and for a small movement, the sprite should rotate less and for a larger rotation the sprite should rotate more.
I have experimented a little and dont get the results. Some times it works for clockwise rotations to the up, right and down movements, but not for the left movements.
What is the math behind this. An example would be the way a device detects its orientation and rotates the screen.
How does one do this correctly?