Author Topic: Accelerometer Orientation  (Read 588 times)

Offline AGP

  • quad
  • ******
  • Posts: 1518
    • View Profile
Accelerometer Orientation
« on: October 06, 2013, 07:40:27 am »
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)?

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

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: Accelerometer Orientation
« Reply #1 on: October 06, 2013, 10:02:57 pm »
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.