-
Hi Everyone, I have a reference to a MRTKRayInteractor in a monobehaviour script I am writing. I am trying to figure out an elegant way to discern which hand the MRTKRayInteractor belongs to. I saw that the MRTKRayInteractor class has a IHandedInteractor.Handedness property, but it is protected and I cant access it. Does anyone have a method which could be used? Thanks! |
Beta Was this translation helpful? Give feedback.
Answered by
keveleigh
Apr 11, 2024
Replies: 1 comment 1 reply
-
You have two main options, both involving casting. The first directly accesses the property you asked about, while the second is essentially a reimplementation of that property. I'd probably recommend the first!
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
j-polden
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You have two main options, both involving casting. The first directly accesses the property you asked about, while the second is essentially a reimplementation of that property. I'd probably recommend the first!
Handedness handedness = ((IHandedInteractor)rayInteractor).Handedness;
Handedness handedness = rayInteractor.xrController is ArticulatedHandController articulatedHandController ? articulatedHandController.HandNode.ToHandedness() : Handedness.None;