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 - Android accelerometer z-axis incorrect
Summary: Android accelerometer z-axis incorrect
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: joystick (show other bugs)
Version: HG 2.0
Hardware: All Android (All)
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-09-17 01:06 UTC by Alex Szpakowski
Modified: 2016-09-30 00:16 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.