Acceleration Orientation Bafflementation

Monkey Targets Forums/Android/Acceleration Orientation Bafflementation

ElectricBoogaloo(Posted 2013) [#1]
Hmm.. A quirky little issue, tonight.

I sent out a test beta game thing, and have so far received one odd bit of feedback.
The game is sensing X/Y tilting the wrong way around, on the user's device. (But is the right way around on mine. Oh goody, Android dev issues!)

The game plays in Portrait mode, so I'm guessing the device is (for some reason) leaving the accelerometer in Landscape, for some odd reason.
Not really sure how to cope with this one.
Any tips on guessing which way around the tilt/device is setup?

..In before "Perhaps an example of the sourcecode might help?"
			J_AX=-(J_AX_Level-AccelX())
			J_AY=-(J_AY_Level-AccelY())
' Where J_AX and J_AY are the values I use,
' and the _Level ones are used to reset the level of the device to 0,0, whenever the icon it tapped.

^ It's AccelX and AccelY. Nothing magical.


Uncle(Posted 2013) [#2]
Hello,

I had this problem too, as there seems to be no standard orientation in Andriod and therefore you need to do some jiggery-pokery to get it consistent on all machines. I don't have my code to hand but I recall having to use the functions in this thread http://www.monkeycoder.co.nz/Community/posts.php?topic=1943#18788 to work out the orientation and then alter the accelx and accely values accordingly.

Cheers,

Andrew


ElectricBoogaloo(Posted 2013) [#3]
Thanks Uncle Andy, I'll look into that :D