如果我想获得手射线的击中对象和位置,等效的代码是什么? 我正在查看此页面,但它仅显示事件驱动的结果。 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;
}
答案 0 :(得分:1)
我发现凝视的代码是:
if (CoreServices.InputSystem.GazeProvider.GazeTarget != null)
{
return CoreServices.InputSystem.GazeProvider.HitPosition;
}
https://microsoft.github.io/MixedRealityToolkit-Unity/Documentation/Input/Gaze.html
答案 1 :(得分:1)
//右射线击中的对象(从MRTK v2.1.0版本开始) GetPointer(Handedness.Right)?. Result.Details?.Object