【问题标题】:Unity Hololens cursor following users gaze off center?Unity Hololens 光标跟随用户注视偏离中心?
【发布时间】:2017-07-21 18:46:02
【问题描述】:

我实际上是在尝试使用我自己的代码来完成 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);
}

【问题讨论】:

  • 如果射线没有击中某物(即凝视太空),你会怎么做?
  • ray.direction 是一个.... direction 你可能不想将它设置为一个 position...跨度>
  • headPosition + gazeDirection * some_distance
  • 统一单位应该是 1 米。请注意,如果您的全息相机的视野非常宽或非常窄,则会人为地影响您所看到的(事物看起来更近/更远)。将视野设置为 60 度以获得最佳体验。
  • 很快发布答案。至于使用设备,我有!它现在在我的办公桌抽屉里。不能等到技术变得更小、更轻、更强大、更大的全息视图区域。尝试使用NavigationRails_ 如果不起作用,请检查哪个轴的值较大(不要忘记Abs() 是)并将另一个值设置为零。

标签: c# unity3d hololens


【解决方案1】:

统一单位应该是 1 米。

请注意,如果您的 hololens 相机的视野非常宽或非常窄,则会人为地影响您所看到的内容(事物看起来更近/更远)。在我正在进行的一个项目中,我的同事将要成为全息图的物体放在距离相机 500 单位的地方,然后将 FOV 设置为 10,这使得它们不会坐在现实世界墙壁和地板所在的空间中.如果你试图绕着物体走动,你就做不到。

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

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

【讨论】:

    猜你喜欢
    • 2015-10-07
    • 1970-01-01
    • 2020-01-28
    • 2020-03-14
    • 2019-10-21
    • 1970-01-01
    • 2011-03-24
    • 2021-01-12
    • 2021-01-15
    相关资源
    最近更新 更多