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

Add alternative LOSAngularOffsetHandRayPoseSource #625

Merged
merged 3 commits into from
Feb 2, 2024

Conversation

whebertML
Copy link
Contributor

Fixes #548
Likely also fixes #580

Fixes the issue by adding an alternative hand ray pose source that can optionally be used that is much less affected by head rotations. To utilize the new hand ray pose source, within the MRTK XR Rig, select the Far Ray of each hand:

image

Then in the Inspector for each Far Ray, add an Aim Pose Source and select the LOSAngularOffsetHandRayPoseSource. Move the new pose source to the top of the list so it takes precedence, and set the hand:

image

Example video demonstrating the change. The white ray is the existing hand ray, the green ray is the new LOSAngularOffsetHandRayPoseSource:

org.MixedRealityToolkit.MRTK3Sample-20240125-101136.mp4

* Adds an alternative line of sight (LOS) with angular offset hand ray
  pose source.
* Adds a ctor to StablizedRay providing distinct values for position and
  direction half life.
@AMollis
Copy link
Contributor

AMollis commented Jan 25, 2024

@whebertML , please hold off on merging until someone at MS tests on HL2. Thank you

@whebertML
Copy link
Contributor Author

@AMollis Sounds good. 👍 Curious how it behaves on HL2. Similar behavior on ML2 and Quest (2/3).

@whebertML whebertML added Package: Core The Project core package is impacted by this issue. Package: Input The Project input package is impacted by this issue. labels Jan 25, 2024
@shaynie
Copy link
Contributor

shaynie commented Jan 25, 2024

@whebertML Thanks - I'll check it out today.

@shaynie
Copy link
Contributor

shaynie commented Jan 25, 2024

It worked OK on HL2 after an initial problem when I didn't set the 'hand' field on the two pose sources. If you don't set the hand, you get errors if you try to run it in editor and the hand ray shoots out of the side of your hand on device. After configuring the pose sources correctly and rebuilding, everything worked on HL2.
I suggested to @whebertML that we try to find a way to disallow or warn of improper configuration.

@whebertML
Copy link
Contributor Author

@AMollis @shaynie Would something like this at the top of the TryGetPose method work?

        Debug.Assert(Hand == Handedness.Left || Hand == Handedness.Right, $"The {GetType().Name} does not have a valid hand assigned.");

        XRNode? handNode = Hand.ToXRNode();

        if (!handNode.HasValue)
        {
            pose = Pose.identity;
            return false;
        }

Should be added to the existing PolyfillHandRayPoseSource as well, then, since it doesn't check for valid hand either currently.

@shaynie
Copy link
Contributor

shaynie commented Jan 29, 2024

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@whebertML whebertML merged commit 3aa92c5 into MixedRealityToolkit:main Feb 2, 2024
4 checks passed
@whebertML whebertML deleted the issue548 branch May 8, 2024 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: Core The Project core package is impacted by this issue. Package: Input The Project input package is impacted by this issue.
Projects
None yet
4 participants