android - Accelerometer x and y values are exchanged on smartphones and tablets -
i use accelerometer in app , activity in landscape mode. x axis used speeding (imagine racing game) , y axis used control direction left , right. have following problem:
on smartphone in landscape mode x axis shorter 1 , y axis longer one. camera positioned @ shorter side.
on tablet axis vice versa. camera on longer side. means x axis shorter 1 (right / left) , y axis longer 1 (backward / forward). means user needs tilt tablet left , right speeding , backwards , forwards controlling direction. not want.
can tell me way find out if axis vice versa? thought detecting if got tablet or smartphone there tablets axis (and camera position also) same on smartphone.
edit: made little picture paint (i know i'm not painter^^). hope understand problem better. top 1 smartphone, bottom 1 tablet - both in landscape mode. circle camera shows y-axis camera is.
i solved problem getting default device orientation , use determine if need use x or y speed.
see https://stackoverflow.com/a/9888357/1794338 getting default device orientation
Comments
Post a Comment