MixedRealityToolkit-Unity icon indicating copy to clipboard operation
MixedRealityToolkit-Unity copied to clipboard

Hand ray disappears when hand gets near SR

Open chbecker-ms opened this issue 7 years ago • 4 comments

Hand rays should only disappear when hands are near grababble or touchable things, not when the hand is near a non-interactive element like SR (the surface mesh).

Additional Context

This is happening because SpherePointer.IsNearGrabbable will return true if it is near ANY collidable, but it should only return true if it is near something that is grabbable (has NearInteractionGrabbable component on it).

And instead of doing an extra sphere cast we should just take advantage of focus system and just check if the sphere pointer is focusing anything.

Workaround

Here's how you can work around this issue, for the SR mesh:

LayerMask toIgnore = LayerMask.GetMask("Spatial Awareness") | UnityEngine.Physics.IgnoreRaycastLayer;return UnityEngine.Physics.CheckSphere(position, NearObjectRadius, ~toIgnore);

Add that in SpherePointer.cs wherever Physics.CheckSphere runs.

chbecker-ms avatar May 07 '19 00:05 chbecker-ms

This bug was filed a while back I think in response to some code review. At the time this was brought up, but the author actually fixed it in the same review and so this bug immediately went stale.

https://github.com/microsoft/MixedRealityToolkit-Unity/blob/mrtk_development/Assets/MixedRealityToolkit.SDK/Features/UX/Scripts/Cursors/FingerCursor.cs#L199

The original bug references this section, which used to do a sphere raycast (instead of just an interactiongrabbable search)

tl;dr this was fixed in the same PR that this issue was filed against so it's not relevant anymore

wiwei avatar May 07 '19 23:05 wiwei

suggestion for fix: create a 'grabbable layer mask' similar to what the poke pointer does with poke layer masks, and in SpherePointer.IsNearObject, query using the grab layer mask filter.

Addison had previously created this solution, but then I reverted it to reduce risk from his change, because the layer mask was unrelated to his PR. We should bring that change back in.

julenka avatar Aug 13 '19 18:08 julenka

Marking urgency soon since it blocked several people who were using sr meshes in MRTK.

julenka avatar Aug 21 '19 22:08 julenka

fixed.

julenka avatar Aug 30 '19 15:08 julenka