I am creating a 3D iphone game where the player navigates obstacles by tilting of the device and moving in a 2D plane, the X and Y. I have gotten the tilting acceleration to work, however, it only works if my iphone is completely horizontal, otherwise it goes off to the side because it is checking the acceleration from that point. How can I make it so that whatever position the iphone is in right before I check the acceleration, it will use that point instead of the one with it being completely horizontal. If I have not explained this well enough I can try again. Here is my code for the acceleration:
dir.x = Input.acceleration.x;
dir.y = Input.acceleration.y;
transform.position = new Vector3(transform.position.x + dir.x, transform.position.y + dir.y, -24);
Thanks again.