[英]VR gaze system from scratch, pointer didnt follow mobile “head”
I started to make a simple VR gaze system from scratch, using Unity ARFoundation.我开始使用 Unity ARFoundation 从头开始制作一个简单的 VR 凝视系统。 First thing was to draw a line from my point of view to "infinity", like a pointer.
首先是从我的角度画一条线到“无限”,就像一个指针。 I have this script running on my AR Session Origin at Update:
我在我的 AR Session Origin at Update 上运行了这个脚本:
myLine.SetPosition(0, transform.position);
myLine.SetPosition(1, transform.position+(transform.forward*1000));
This works on editor, I have a line, and I can turn and move my session origin (my "head" with camera), it follows up.这适用于编辑器,我有一条线,我可以转动并移动我的 session 原点(我的“头”与相机),它会跟进。
But, when I use it on mobile... the line keeps still, doesnt turn and move with the device.但是,当我在移动设备上使用它时……线路保持静止,不会随着设备转动和移动。
What´s wrong?怎么了?
Oh well... nevermind.哦,好吧……没关系。 I solve it.
我解决它。 I needed a reference to the arCameraManager, it holds the head-tracking information.
我需要对 arCameraManager 的引用,它包含头部跟踪信息。
myLine.SetPosition(0, arCameraManager.transform.position);
myLine.SetPosition(1, arCameraManager.transform.position+arCameraManager.transform.forward*100));
o/ o/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.