www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: AGP on October 06, 2013, 07:40:27 am

Title: Accelerometer Orientation
Post by: AGP 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];
}
}
Title: Re: Accelerometer Orientation
Post by: EgonOlsen 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.