Reputation: 61
What would be the equivalent code if I want to get hand ray's hit object & position? I am looking at this page but it shows event-driven result only. https://microsoft.github.io/MixedRealityToolkit-Unity/Documentation/Input/Pointers.html#pointer-result
private static Vector3 GetGazePlacementPosition(Vector3 headPosition, Vector3 gazeDirection, float defaultGazeDistance)
{
if (GazeManager.Instance.HitObject != null)
{
return GazeManager.Instance.HitPosition;
}
return headPosition + gazeDirection * defaultGazeDistance;
}
Upvotes: 1
Views: 386
Reputation: 61
// The object the right-hand ray hit (from MRTK v2.1.0 release) GetPointer(Handedness.Right)?.Result.Details?.Object
Upvotes: 2
Reputation: 61
I found that the code for Gaze would be:
if (CoreServices.InputSystem.GazeProvider.GazeTarget != null)
{
return CoreServices.InputSystem.GazeProvider.HitPosition;
}
https://microsoft.github.io/MixedRealityToolkit-Unity/Documentation/Input/Gaze.html
Upvotes: 2