jPCT-AE - a 3d engine for Android > Support

Accelerometer Orientation

(1/1)

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)?


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

--- End code ---

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.

Navigation

[0] Message Index

Go to full version