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 ios accelerometer input bugs #124

Merged
merged 5 commits into from
Oct 13, 2017

Conversation

melmaliacone
Copy link
Contributor

@melmaliacone melmaliacone commented Oct 11, 2017

Previously, rotation with the accelerometer did not work in landscape mode.
The heading variable needed to be changed to use the device motion roll rather than the device motion pitch to have to correct behavior. This is because the axis along the y direction changes when the phone is put in landscape mode.

I tested this by running the app on my phone and rotating it around in portrait, left landscape, and right landscape mode. I made sure to switch from one mode to the other and confirm that I still saw the desired behavior.

Fixes #117

@bengreenier
Copy link
Collaborator

bengreenier commented Oct 11, 2017

@Maliac11 and I just spoke offline and we're going to see if we can get a 💪 🔥 ui test to cover this behavior so that we can verify going forward that it's 💯 working. We'll revisit this topic on Friday, and if things aren't progressing with a test that can cover that, we'll re-evaluate (both of us are new to testing in swift).

@bengreenier bengreenier changed the title Check for device orientation and adjust pitch and heading accordingly fix ios accelerometer input in landscape mode Oct 11, 2017
Copy link
Collaborator

@bengreenier bengreenier left a comment

Choose a reason for hiding this comment

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

looks really great! thanks @Maliac11 🔥 🔥

just a few nitpicky things that could be improved, but i'm satisfied with this code! As discussed, we'll hold off on merging this (hence my non-approval here) until we can get some tests or investigate and decide testing this behavior is overly complicated. 💯

navPitch = prevNavPitch + dpitch

if UIDevice.current.orientation == .landscapeLeft {
print("left")
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: can we remove these prints, seems like the rest of the nearby deviceMotion code doesn't log any info, and if we're confident this works i think we can avoid these statements 🥇

} else if UIDevice.current.orientation == .landscapeRight {
navPitch = prevNavPitch + droll
navHeading = prevNavHeading - dheading
print("right")
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: can we remove these prints, seems like the rest of the nearby deviceMotion code doesn't log any info, and if we're confident this works i think we can avoid these statements 🥇

} else {
navPitch = prevNavPitch + dpitch
navHeading = prevNavHeading - dheading
print("else")
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: can we remove these prints, seems like the rest of the nearby deviceMotion code doesn't log any info, and if we're confident this works i think we can avoid these statements 🥇

@bengreenier
Copy link
Collaborator

@michaelperel @Maliac11 if i understand correctly this also now fixes #119 ?

@bengreenier bengreenier changed the title fix ios accelerometer input in landscape mode fix ios accelerometer input bugs Oct 13, 2017
Copy link
Collaborator

@bengreenier bengreenier left a comment

Choose a reason for hiding this comment

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

per @michaelperel there is a disconnect crash bug present here, and he has a pending fix. blocking merge until the fix goes in

Copy link
Collaborator

@bengreenier bengreenier left a comment

Choose a reason for hiding this comment

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

my inability to test these changes is starting to feel scary 😆

until i get a mac i'll assume this fix works as expected! 💯 🔥 😸

@bengreenier
Copy link
Collaborator

per convo with @Maliac11 we're going to merge this without these ui tests at this point, as we believe the cost of authoring them is much greater than the value they'll provide. as such, merging.

@bengreenier bengreenier merged commit 681b231 into 3DStreamingToolkit:master Oct 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants