shiny icon indicating copy to clipboard operation
shiny copied to clipboard

Gimbal lock

Open JCJutson opened this issue 6 years ago • 4 comments

Seems like gimbal lock is an issue when testing out on my phone. https://en.wikipedia.org/wiki/Gimbal_lock

JCJutson avatar Jan 16 '19 13:01 JCJutson

If it wasn't for Gimbal Lock I would've released it a week ago. It's really tricky to wrap my non-math brain around. Any ideas on fixing it are more than welcome.

All we need is to map the relative beta and gamma rotation to the x and y-axis.

rikschennink avatar Jan 16 '19 13:01 rikschennink

The code here can compute the quaternion from the alpha, beta, gamma values: https://www.w3.org/TR/2016/CR-orientation-event-20160818/#worked-example-2 Then tracking the changes from the quaternion instead of from alpha, beta, gamma should fix it?

JCJutson avatar Jan 16 '19 13:01 JCJutson

I believe I tried this earlier but will give it another go.

rikschennink avatar Jan 16 '19 14:01 rikschennink

You can also prevent the angles from going to exactly zero/max to prevent gimble lock. No one will notice if an angel never goes to less than 0.0001 degrees.

DanielJoyce avatar Jan 17 '19 23:01 DanielJoyce