Solver Handler does not track right hand when tracked target type is set to Controller Ray or Interactor
This issue has been migrated a new MRTK repository, and the status of this issue will now be tracked at the following location:
- https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/issues/244
This is for MRTK 3 using the Solver Handler to attach an object to the end of a hand ray.
When the solver Handler's Tracked Target Type is set to Controller Ray, it reverts to Interactor which requires two XRBaseInteractors to be assigned.
In our use case, the solver handler is in a prefab which gets instantiated later so the Ray Interactors cannot be manually assigned. We added a component in the prefab that assigns the interactors on instantiation. All this is working fine, if that's the intended pattern we should use.
The actual issue When the solver handler's Tracked Target Type is set to Controller Ray (Interactor) it will only listen to the left hand which is set as the preferred hand. This occurs even when there is only a right hand or right controller present. When the right hand/controller is present the solver stops working, it does not attach an object to the end of the ray.
To reproduce
- Set a Solver Handler's Tracked Target Type to Controller Ray
- Assign MRTK Ray Interactors for each hand to the XRBaseInteractor fields.
- Use the right hand
- Nothing happens, only the left hand ray works
Expected behavior
The Solver handler should switch hand or controller rays when the user switches hands or controllers.
Screenshots
I've added some modifications to fix this locally on line 444. Instead of always assigning the left handedness (PreferredTrackedHandeded), a function is called to chech if the other hand is present instead.

Proposed function

I can push a PR for this unless there are other changes in the works.
Your setup (please complete the following information)
- Unity Version [2021.3.11f1]
- MRTK Version [v3.0]
Target platform (please complete the following information)
- HoloLens 2
- WMR immersive
- OpenVR
Additional context
Add any other context about the problem here.
Another issue is IsInvalidTracking does not have a condition for TrackedTargetType == TrackedTargetType.ControllerRay beyond testing if the controllerInteractor is null.
Here's a rough workaround to get the ControllerRay case to swap tracked interactors.
IsInvalidTracking is a private function, so we can't extend this to modify these conditions. It would be nice to have each condition separated into a function call specific to the TrackedTargetType. For both IsInvalidTracking and AttachedToNewTrackedObject. The latter is protected, but that's a lot of duplicate code to copy over to modify one line.
This is another method to test if the Interactor is being tracked or not. There may be a better way to check this.

I don't like how this last function is getting called so many times per frame, per hand to make the workaround function, I'm sure there's a better way to condense that logic.
We're currently working on completely refactoring the solvers + constraints architecture. It will cover this, and much more :) Stay tuned! It'll combine solvers, constraints, elastics, other sorts of pose modifiers... etc. @RogPodge can chime in.
In the meantime, if you need a fix merged, please feel free to open a PR; we'd be more than happy to take a look.
Just for the sake of documentation, the best work around was to set the Solver Handler to Custom Override and set TransformOverride with the target Interactors using another script. That keeps everything clean until the updates come. Looking forward to it. Thanks.
Thanks for the info @killerantz .