Accelerometer Orientation

Started by AGP, October 06, 2013, 07:40:27 AM

Previous topic - Next topic

AGP

Orientation of values[1] is different between the Galaxy S4 and the Nexus 10. Now that I think about it, it may be that it's because one is a phone and one is a tablet (hopefully between phones the value will be consistent and the same for tablets). So I have two questions:
1) Is it because one is a phone and the other is a tablet?
2) Either way, how do I test for it or otherwise get the desired result (I want for a landscape game to tilt sideways to move my hero)?


public void onSensorChanged(SensorEvent e) {
float[] values = e.values;
if (values[1] > .2f) {
xTranslation = values[1];
}
else if (values[1] < -.2f) {
xTranslation = values[1];
}
}

EgonOlsen

No idea. I think that the value will differ from device to device. Maybe you have to calibrate it somehow. I bet there are answers to this question somewhere out there.