我需要一些有关使用 Daydream 进行光线投射 UI 的帮助。由于只有游戏对象(立方体)的演示,我想知道我可以处理 UI 元素。UI 元素应该像往常一样做出反应,我的意思是突出显示等等。如何在 WorldSpace UI 中使用 Graphic Raycaster中的帖子?很有帮助,但完全。
我使用 DrawRay 来查看我的指针实际经过的位置,并且效果很好。但是没有创建日志消息。
void Update()
{
Quaternion ori = GvrController.Orientation;
Vector3 vector = ori * Vector3.forward;
Debug.DrawRay(transform.position, vector * 100000, Color.green);
PointerEventData pointerData = new PointerEventData(null);
pointerData.position = vector;
Debug.Log(vector);
List<RaycastResult> results = new List<RaycastResult>();
EventSystem.current.RaycastAll(pointerData, results);
if (results.Count > 0)
{
Debug.Log(results[0]);
}
}
画布(世界空间)和按钮被创建为有用的而不是修改的。