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

Fixing SurfaceMagnetism quaternion math #10074

Merged
merged 3 commits into from
Jul 13, 2021
Merged

Conversation

Zee2
Copy link
Contributor

@Zee2 Zee2 commented Jul 13, 2021

Overview

Currently, SurfaceMagnetism uses Vector3.up as the up vector for all surface normal Quaternion.LookRotation calculations. This causes gimbal-lock-like behavior when the surface that is being magnetized to is mostly looking upwards. This manifests in ugly temporal instability when a hologram is magnetized to the floor of the scene reconstruction mesh.

The quaternion math in SurfaceMagnetism has been fixed to now use the "best guess" up vector, derived from the current working rotation's up vector. This ensures temporal stability in all cases. Compatibility has been ensured with both modes of KeepOrientationVertical, as well as OrientationMode.TrackedTarget.

A unit test has been added that verifies the absence of any gimbal locking behavior when a floor-like surface is tilted/updated.

Changes

Verification

The test should cover #10064's reported incident. @holomatt feel free to clone this PR and verify that your issue is fixed.

@Zee2 Zee2 added this to the MRTK 2.x future milestone Jul 13, 2021
@Zee2 Zee2 requested review from keveleigh and CDiaz-MS July 13, 2021 20:34
@Zee2 Zee2 self-assigned this Jul 13, 2021
@Zee2
Copy link
Contributor Author

Zee2 commented Jul 13, 2021

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@Zee2 Zee2 merged commit 8c0a007 into microsoft:main Jul 13, 2021
@polar-kev polar-kev modified the milestones: MRTK 2.x future, MRTK 2.7.3 Nov 22, 2021
keveleigh pushed a commit to keveleigh/HoloToolkit-Unity that referenced this pull request Dec 7, 2021
keveleigh pushed a commit to keveleigh/HoloToolkit-Unity that referenced this pull request Dec 7, 2021
keveleigh pushed a commit to keveleigh/HoloToolkit-Unity that referenced this pull request Dec 7, 2021
keveleigh pushed a commit to keveleigh/HoloToolkit-Unity that referenced this pull request Dec 7, 2021
keveleigh pushed a commit to keveleigh/HoloToolkit-Unity that referenced this pull request Dec 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants