Looking-Glass / looking-glass-webxr

WebXR for Looking Glass displays
https://docs.lookingglassfactory.com/developer-tools/webxr
Apache License 2.0
66 stars 16 forks source link

Issue: View transforms provided by the Looking Glass polyfill are subject to gimbal lock #47

Open tbirdso opened 1 year ago

tbirdso commented 1 year ago

Background

From Wikipedia:

Gimbal lock is the loss of one degree of freedom in a three-dimensional, three-gimbal mechanism that occurs when the axes of two of the three gimbals are driven into a parallel configuration, "locking" the system into rotation in a degenerate two-dimensional space.

In practice, we observe gimbal lock in 3D scenes when the camera cannot pivot smoothly in a great circle (360-degrees) in any given direction.

Expected behavior

After launching a holographic scene with the Looking Glass polyfill, we expect to be able to continuously drag "down" to rotate (pitch) about an object by 360 degrees.

Observed behavior

After launching a holographic scene with the Looking Glass polyfill, we can drag "down" to rotate (pitch) the object by 90 degrees. At that point dragging "up/down" or "left/right" appears to roll the object, but can no longer pitch the object in the same direction.

Steps to Reproduce

Reproduced in React-Three-Fiber example: https://docs.lookingglassfactory.com/developer-tools/webxr/react-three-fiber

Steps:

  1. Open the cubes example in a new tab/window: https://ikz8zu.csb.app/
  2. Send to Looking Glass and double-click to maximize
  3. Try to click and drag the scene straight up or straight down. We would expect that the camera remains centered between the two cubes, but instead after a 90-degree pitch the cubes begin to roll about the camera forward vector.

Can also reproduce with VolView experimental holographic support: https://deploy-preview-438--volview-dev.netlify.app/

Additional Notes