@Aditya, as tkhoman said, different android devices handle this differently, I recollect the Huawei Tablet about 2/3 years ago was inverted and the same code on another android phone worked fine. Where as it is all standard for all iOS devices.
@Aditya, what I faced was like the true scroll on OSX since Lion, where if I tilted the device downwards, the ball (or rather the ball bearing in Labyrinth) moved upwards and the other way around. This is one of the main reasons why development with an iOS device is a pleasure. However people/users (in India) still love their Androids.
@aditya by calibration I meant give users instructions, like 1) put device on the flat surface in landscape mode 2) record the accelerometer readings 3) ask user to put device on the flat surface in portrait mode 4) record readings 5) decide based on values how to use accelerometer 6) store these settings for every use later
@Aditya, you would never know if the accelerometer is inverted or not. However you can have a switch in the UI, something like the true scroll that could allow the user to invert the accelerometer, which means you either swap or invert the values received.
something like
if accel_inverted ==truethen
x = -x
else-- Do nothing hereend
Yes as @OZApps said, there also could simply be a switch in the settings, and you could notify user during a loading screen, if you experience problems with accelerometer, try switching axis (or calibration)
I also came across this problem in a game I was playing where you had to roll a ball through a labyrinth to progress in the game. Having struggled (and failed!)for ages trying to make myself do the opposite of what was natural, cursing the developoer for making it so difficult, I decided to turn my tablet upside down which fixed it.
That game allowed autorotate of the screen. Is that not possible on Android? I know that the settings are either landscape left or landscape right so I'm guessing there is some reason why Gideros won't autorotate?
A new function Application:getDeviceOrientation is coming with the next version. So that you can fix the accelerometer data with a simple code without checking the OS.
A new function Application:getDeviceOrientation is coming with the next version. So that you can fix the accelerometer data with a simple code without checking the OS.
will the orientation change events also be coming?
Comments
I also got it inverted on some devices.
Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
Cool Vizify Profile at https://www.vizify.com/oz-apps
which device it is exactly?
I know some device's accelerometer behavior depends on the orientation, while most of them use absolute values.
I think that is mostly the reason why games implement sensor calibration, to understand how this specific device behaves and then adjust accordingly.
Currently I don't know any programmatical way to detect the different behavior
http://www.giderosmobile.com/forum/discussion/2559/accelerometer-values-in-upside-down#Item_8
https://sites.google.com/site/xraystudiogame
@ar2rsawseen: Nexus 7 tablet. The orientation has been set as 'landscape_left' in gideros and 'landscape' in androidmanifest.
The problem as others have mentioned above, is that I don't really have a list of devices which invert the axes to compare and check with.
Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
Cool Vizify Profile at https://www.vizify.com/oz-apps
Would we happen to have a fix for this problem in gideros?
1) put device on the flat surface in landscape mode
2) record the accelerometer readings
3) ask user to put device on the flat surface in portrait mode
4) record readings
5) decide based on values how to use accelerometer
6) store these settings for every use later
something like
Likes: aditya
Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
Cool Vizify Profile at https://www.vizify.com/oz-apps
if (application:getDeviceInfo()=="Android") then
--Android Movement
else
--iOS Movement
end
Not the best way after reading comments on this thread. You are right I would have to add it as an option in the 'Settings' screen as a last resort.
That game allowed autorotate of the screen. Is that not possible on Android? I know that the settings are either landscape left or landscape right so I'm guessing there is some reason why Gideros won't autorotate?
Would second application:getOrientation() giving out the active orientation of the device.
Likes: aditya
https://sites.google.com/site/xraystudiogame