Hi all, I'm wrapping my game up and I keep getting requests from the beta testers to add accelerometer support.
The game is a top-down car game ( http://www.cleverhamstergames.com/games/minitaxi/ ).
At the moments it implements a mini touch steering wheel.
I've had a good look around but couldn't find much help when it comes to making sense of the data that the accelerometer gives me.
I'm using this code:
#define kFilterFactor 0.5f
float accelY = (float) acceleration.y * kFilterFactor + (1- kFilterFactor)*prevY;
This gives me an output for the Y axis that is somewhat usable as a "steering wheel" effect.
The problem is that the tilt of the iPhone changes things radically.
If I stand and hold it in front of me, I get readings between -1 and 1.
If it's 45 degree tiled, the values decrease.
If I keep the device on a table and rotate it like a steering wheel, I get no meaningful readings from any of the 3 axis.
So, I'm guessing, I have to combine the values of all the axis (or only 2?), to get something meaningful.
I post this as I'm quite lost and hoping that somebody might be able to point me in the right direction.
Thanks,
Patrick