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

Making differences between floor-offset-relative space and rig-relative space explicit #11035

Merged
merged 33 commits into from
Oct 6, 2022

Conversation

Zee2
Copy link
Contributor

@Zee2 Zee2 commented Sep 20, 2022

Overview

So far in MRTK3, we've used device-relative coordinates for everything, with the head always starting at 0,0,0. However, XROrigin and Unity XR in general have two different "origin tracking modes": Floor and Device. In Floor mode, trackables are reported relative to the precalibrated floor elevation; i.e., the coordinate space is absolute. In Device mode, trackables are reported relative to the point in space at which the HMD was first detected. Some devices support both (Quest, VR in general), and some devices only support Device mode (HoloLens, etc).

This PR makes our rig respect both modes. By default, the XROrigin is now set to Unspecified mode, with a default backup floor height of 1.6m. On VR devices with precalibrated floor heights, the device pose(s) will be reported with absolute coordinates, and the Camera Offset object will have an offset of (0,0,0). On devices that only support Device mode, the 1.6m backup offset will be applied to the CameraOffset object.

The sample scenes have been re-authored accordingly; all content is now placed at "head height" (1.6m). This is a breaking change, as downstream users will have to re-center their app's content to use appropriate heights/positions. (The alternative would be to set their XROrigins to Device mode only, with the awareness that this may break locomotion or avatars for VR content).

Fixes #11017.

Changes

  • Deprecates PlayspaceUtilities.ReferenceTransform.
    • Users should now use either PlayspaceUtilities.XROrigin.CameraFloorOffsetObject (for AR trackables like device poses, anchors, and meshes) or PlayspaceUtilities.XROrigin.Origin for checking where the user's rig (0,0,0) is.
  • Moves XROrigin and ARSessionOrigin onto the CameraOffset object itself
    • This is so that AR trackables like anchors, meshes, planes, and trackable devices are placed relative to the OpenXR scene-origin-space.
  • Adjusts all sample scene content to be absolutely positioned for head-height.
  • Removed extraneous ProxyInteractor from InputFieldExamples
  • Removed extraneous ProxyInteractor from VirtualizedScrollRectList example scene
  • Fixed LoFiAudio example scene (UI was broken and unresponsive)
  • Fixed the SpatialMapping example scene (was previously broken due to missing mesh manager), and ensured it works with the new rig hierarchy
  • Added more comprehensive description to SpatialMapping example scene
  • Fixed wonky Gaze example scene materials
  • Added TransformPose, InverseTransformPose helpers to PlayspaceUtilities
  • Fused most uses of position + rotation in InputSimulator and simulated devices into using Pose structs
  • Fixed misleading naming in InputSimulator (SimulatedInputPosition/Rotation -> CameraRelativePose)
  • Fixed incorrect coordinate space transformation in PolyfillHandRayPoseSource
  • Fixed incorrect coordinate space transformation in ArticulatedHandController (devicePose was assumed to be global)

Verification

All existing unit tests pass. Would appreciate verification from the rest of the team testing other VR devices.

@Zee2 Zee2 marked this pull request as draft September 20, 2022 04:16
@github-actions github-actions bot added the MRTK3 label Sep 20, 2022
@Zee2 Zee2 self-assigned this Sep 29, 2022
Copy link
Contributor

@RogPodge RogPodge left a comment

Choose a reason for hiding this comment

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

Did a review of the code files and those look good to me.

Copy link

@david-c-kline david-c-kline left a comment

Choose a reason for hiding this comment

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

Looks reasonable to me

Copy link
Contributor

@keveleigh keveleigh left a comment

Choose a reason for hiding this comment

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

Didn't really look at all the scenes this time around, but the rest seems reasonable!

@Zee2 Zee2 enabled auto-merge (squash) October 6, 2022 20:58
@Zee2 Zee2 merged commit f1416d8 into microsoft:mrtk3 Oct 6, 2022
drusk-unity pushed a commit to drusk-unity/MixedRealityToolkit-Unity that referenced this pull request Jun 26, 2023
…ve space explicit (microsoft#11035)

* Making reference transform coordinate system explicit

* Switching all coordinate transformations to be explicit about rig-local space vs floor-offset-relative-space.

* Naming fix

* Naming

* Revising based on convo with Kurtis

* Removing extra properties

* Refactoring

* Fixing incorrect coordinate space transformation in PolyfillHandRayPoseSource

* Playspace math refactor

* Lots of simulator fixes

* Rearranging rig

* Adjusting HIE scene height

* SpatialMapping scene update

* More descriptive spatial mapping info panel

* Adjusting vertical position of all scenes

* Making input sim default to Grab anchor due to new (more accurate) ray calculation

* Adding Pose property and constructor to HandJointPose

* Adding more reasonable overloads/utility methods in PlayspaceUtilities

* Fixing device pose math in ArticulatedHandController

* PR Feedback

* Fixing more scenes to use correct elevation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants