0 votes
by (120 points)

我使用了demo中的脚本,GetCombineEyeGazePoint获取的值是正常的,但GetCombineEyeGazeVector获取的值始终为0

 IEnumerator EyeRaycast(float steptime)
    {
        while (true)
        {
            if (Camera.main)
            {
                matrix = Matrix4x4.TRS(Camera.main.transform.position, Camera.main.transform.rotation, Vector3.one);
            }
            else
            {
                matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, Vector3.one);
            }
            bool result = (PXR_EyeTracking.GetCombineEyeGazePoint(out Vector3 Origin) && PXR_EyeTracking.GetCombineEyeGazeVector(out Vector3 Direction));
            PXR_EyeTracking.GetCombineEyeGazePoint(out Origin);
            PXR_EyeTracking.GetCombineEyeGazeVector(out Direction);
            var RealOriginOffset = matrix.MultiplyPoint(Origin);
            var DirectionOffset = matrix.MultiplyVector(Direction);
            if (result)
            {
                Ray ray = new Ray(RealOriginOffset, DirectionOffset);
                RaycastHit hit;
                if (Physics.Raycast(ray, out hit, 200))
                {
                    if (hit.collider.transform.name.Equals("zbx"))
                    {
                        Debug.Log("zbx---" + hit.point);
                        greenpoint.gameObject.SetActive(true);
                        greenpoint.position = hit.point;
                    }
                }
                else
                {
                    greenpoint.gameObject.SetActive(false);
                }
            }
            yield return new WaitForSeconds(steptime);
        }
    }

1 Answer

0 votes
by (5.3k points)

你用的sdk版本是什么呢,demo打包一下看看能不能正常工作,我这是正常的,所以怀疑你的设置没弄好,检查一下PXRmanager有没有挂载,里面的eyetracking有没有打开。同时也可以试试把你项目里的sdk重新导入一下。

by (120 points)

PICO XR SDK 2.0.5的版本,我把PUI更新到最新版本,就能获取到了,这就很扯了。

...