We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3427

Summary: Android accelerometer z-axis incorrect
Product: SDL Reporter: Alex Szpakowski <amaranth72>
Component: joystickAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: HG 2.0   
Hardware: All   
OS: Android (All)   

Description Alex Szpakowski 2016-09-17 01:06:33 UTC
As seen here https://bitbucket.org/rude/love/issues/1202/accelerometer-z-axis , the Java code for sending accelerometer data to SDL's C code has an incorrect Z-axis calculation.
Comment 1 Sam Lantinga 2016-09-29 23:40:55 UTC
Fixed, thanks!
https://hg.libsdl.org/SDL/rev/c9e2cb97c17d
Comment 2 Sam Lantinga 2016-09-29 23:41:29 UTC
Actually, Alex, can you confirm that with that change iOS and Android match for the same phone orientation?
Comment 3 Alex Szpakowski 2016-09-30 00:16:18 UTC
I don't have an Android device (or any Android development tools set up right now), so I can only test iOS. Some observations:

- with my phone lying flat on a table and the screen facing up, acceleration due to gravity is -Z. It's +Z when the screen is facing down and lying flat.

- holding it vertically in portrait, gravity is +Y. It's -Y when held upside down that way.

- holding it vertically in landscape (with the top of the phone pointing to the right), gravity is +X. Pointing to the left it's -X.

- the window's orientation doesn't affect the gravity values, only the device orientation does.