unity-game-enginehololensmrtkwindows-mixed-reality

Custom Controller and GrabPointer with MRTK 2.4 don't work


My Custom Controller has 3 Pointers.

  1. Ray Pointer (working good)
  2. Poke Pointer (working good)
  3. Grab Pointer (has the SpherePointer.cs Component) not working

With MRTK 2.3 all of them were working. I did not change anything in the Scene and updated to MRTK 2.4.

With MRTK 2.4 the Grab Pointer is not working anymore...when moving it near an nearGrabbable object, I can't grab it, because it doesn't get recognized as a GrabPointer (the yellow Debug Ray is not being draw in the Editor).

But when I am using the Articulated Hand GrabPointer it works. So I copied the prefab and changed only the Pose Action and Pointer Action and it didn't work. What am I missing when using the SpherePointer?

The Controller gets its pose change like this:

CoreServices.InputSystem.RaisePoseInputChanged(InputSource, ControllerHandedness, Interactions[i].MixedRealityInputAction, controllerPose);
                

And the Buttons Presses like this:

CoreServices.InputSystem?.RaiseOnInputDown(InputSource, ControllerHandedness, Interactions[i].MixedRealityInputAction);
CoreServices.InputSystem?.RaiseOnInputUp(InputSource, ControllerHandedness, Interactions[i].MixedRealityInputAction);

EDIT:

Link to the custom input device for reproducing the Bug: https://wetransfer.com/downloads/27b3f2b90c18516dc47a35cf645dc25820200728111556/10711a

  1. Create a empty new Unity Project (2018.4.X, but same with 2019.4.X)
  2. Import MRTK 2.4
  3. Import my Custom Input Package
  4. Open the Bug Scene and see that the sphere pointer is not working for the custom input device.

Solution

  • I fixed the issue: SpherePointer.cs Comparison 2.3 vs 2.4

    As you can see in the picture, the if statement was always false for me. I never assigned IsPositionAvailable to true. Now inside my Controller I added such a line:

                IsPositionAvailable = myControllerPosition != Vector3.zero; 
    

    That line fixed my problem.