Unity Hololens 光标跟随用户注视中心?

Unity Hololens cursor following users gaze off center?

我实际上是在尝试使用我自己的代码来完成 BasicCursor 及其相应脚本 Cursor.cs 为使用 Microsoft Toolkit 进行注视所做的工作。我相信它的 UpdateCursorTransform() 方法是我试图模仿的,但我很困惑。

此时此刻,我的光标跟随用户的目光,但它似乎偏离了中心。光标位于用户实际注视位置的下方和左侧。给出了什么?

这是我的代码..

// Do a raycast into the world based on the user's
// head position and orientation.
var headPosition = Camera.main.transform.position;
var gazeDirection = Camera.main.transform.forward;

RaycastHit hitInfo;
Ray ray;
Camera c = Camera.main;

ray = c.ScreenPointToRay(headPosition);

if (Physics.Raycast(headPosition, gazeDirection, out hitInfo))
{


    // If the raycast hit a hologram...
        objHit = hitInfo.transform;

    // Move the cursor to the point where the raycast hit.
        this.transform.position = hitInfo.point;

    // Rotate the cursor to hug the surface of the hologram.
        this.transform.rotation = Quaternion.FromToRotation(Vector3.up, hitInfo.normal);
}

单位应该是 1 米。

请注意,如果你的全息镜头相机的视野非常宽或非常窄,那将人为地影响你看到的东西(看起来 closer/farther)。在我正在进行的一个项目中,我的同事将要成为全息图的对象放在距离相机 500 个单位的地方,然后将 FOV 设置为 10,这使得它们不会位于 space 真实世界的位置墙壁和地板。如果你试图绕着物体走动,你做不到。

将视野设置为60度以获得最佳体验,我相信预制hololens相机的视野为51。

我不确定为什么尝试从米转换为英寸会得到一个相差 10 次方的值(应该是 ~39.37 的乘数)