Hi everyone,
I am currently coding a little AR-Game for myself using the iPhone 3GS ;-)
I want to use the accelerometer & compass data for rotating my camera in opengl. The camera has a fixed position and can only rotate due to the accelerometer. The iPhone is initially rotated 90° to have a bigger widescreen ;-) So the axes are switched...
When I hold the iPhone straigt in front of me I get this values:
- accel.x = 1
- axxel.y = 0
- accel.z = 0
When move the iPhone straight to the top of me (over my head) I get these values:
- accel.x = 0
- accel.y = 0
- accel.z = 1
So the values are between :
- x: 1 straight ahead and 0 over my head
- y: 0 straight ahed and 0 over my head
- z: 0 straight ahead and 1 over my head
So I want to use x, y, z for my camera world coordinates. E.g. accel.x = 0.5 and accel.z = 0.5
The camera should change the centerX, centerY and centerZ values due to the values I get from the accelerometer.
How can I manage this?
Thanks ;-)