Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sensors on android web #4499

Merged
merged 7 commits into from
Jun 16, 2023
Merged

Conversation

mstach60161
Copy link
Contributor

@mstach60161 mstach60161 commented May 29, 2023

Summary

Problem

Android devices use a right-handed coordinate system, where the positive x-axis points to the right, the positive y-axis points up, and the positive z-axis points out of the screen.
However iOS uses a left-handed coordinate system, where the positive x-axis points to the right, the positive y-axis points down, and the positive z-axis points into the screen.

This is already fixed on android native code, but the problem still exists on android web browser (react native web).

Fix

  • Replace quaternion z, y and negate z
  • Do the same thing on Android native

Test plan

  • Web Example App

@mstach60161 mstach60161 force-pushed the @mstach60161/fix-android-web-sensors branch from 2c70854 to a57b2c3 Compare May 29, 2023 15:55
@mstach60161 mstach60161 force-pushed the @mstach60161/fix-android-web-sensors branch from a57b2c3 to 1abd6a3 Compare May 29, 2023 15:59
@mstach60161 mstach60161 force-pushed the @mstach60161/fix-android-web-sensors branch from 59f8bf2 to ed1d4d0 Compare May 29, 2023 16:14
@mstach60161 mstach60161 marked this pull request as ready for review May 29, 2023 16:24
@mstach60161 mstach60161 requested a review from tomekzaw May 29, 2023 16:24
src/reanimated2/js-reanimated/JSReanimated.ts Outdated Show resolved Hide resolved
src/reanimated2/js-reanimated/JSReanimated.ts Outdated Show resolved Hide resolved
src/reanimated2/js-reanimated/JSReanimated.ts Outdated Show resolved Hide resolved
Copy link
Member

@tomekzaw tomekzaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on iOS and Android, looks like finally it's consistent. Thanks @mstach60161 for taking care of this!

Edit: I've tested pitch, roll and yaw between main and this branch and they are the same but I haven't checked qx, qy, qz and qw individually, is this the expected result?

Edit 2: Ready to merge.

@mstach60161 mstach60161 added this pull request to the merge queue Jun 16, 2023
Merged via the queue into main with commit 3ffea99 Jun 16, 2023
@mstach60161 mstach60161 deleted the @mstach60161/fix-android-web-sensors branch June 16, 2023 11:29
Latropos pushed a commit that referenced this pull request Jun 20, 2023
<!-- Thanks for submitting a pull request! We appreciate you spending
the time to work on these changes. Please follow the template so that
the reviewers can easily understand what the code changes affect. -->

## Summary

### Problem

Android devices use a right-handed coordinate system, where the positive
x-axis points to the right, the positive y-axis points up, and the
positive z-axis points out of the screen.
However iOS uses a left-handed coordinate system, where the positive
x-axis points to the right, the positive y-axis points down, and the
positive z-axis points into the screen.

This is already fixed on android native code, but the problem still
exists on android web browser (react native web).

### Fix

- Replace quaternion z, y and negate z  
- Do the same thing on Android native

## Test plan

- Web Example App
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants