Today I was playing with Android's accelerometer. I am in the process of closing cocos2d-x's issue 242.
Basically I finish coding my first approach but when I run it with the test case the ball went exactly to the opposite side.
I started checking if I was sending the parameters correctly and unfortunately I was doing the right thing :(.
Since the test case was done for an iphone device I checked if the iphone used the same coordinates as Android.
I found two useful links to read about both's accelerometer:
* SensorEvent's doc
If you check the following screens you will notice what I am talking about:
Not completely sure of what was going on I downloaded a demo app to check it gave the same values as my code. We both were sending the same coordinates so there was something different between iphone's and Android's accelerometers.
I ended up download an iphone demo app to check what were the values read. You can see the different outputs with both devices placed in the same position:
Notice the difference in the z axis value.
To fix it, it was just a matter of multiplying by -1 every value from Android's accelerometer.