我正在尝试根据Unity3d上的原始指针创建自己的Recticle指针。 想法是射线的起源是主摄像机,但方向是由主摄像机到食指的矢量定义(将由后摄像头捕获)。但我找不到相关代码来重置标线指针的方向。有谁知道吗?谢谢! I have a father class which is an abstract class called GvrbasePointer. This class have a method to create a ray from main camera(represent the player). I am trying to make this ray's direction flow user's finger position. So I have another class called FingerRay
In FingerRay class I have a method called ControlMovementWithHand, it will return the coordinates of index finger。因此,当我设置everthing时,我使用GvrRecticlepointer来实现父类GvrbasePointer,并且错误消息是(在图1中的蓝线)ullReferenceException:对象引用未设置为对象的实例 GvrBasePointer.CalculateRay(.GvrBasePointer指针,RaycastMode模式)(在Assets / GoogleVR / Scripts / EventSystem / GvrBasePointer.cs:356)
我不知道如何以及在哪里我应该在GvrBasePointer中实例化FingerRay。如果我可以改变Unity中每个组件的级别。我在MainCamera下附加了GvrReticlePointer脚本,并在另一个与主摄像机处于同一级别的对象下附加了FingerRay。
基本上我使用googlevr sdk https://developers.google.com/vr/unity/reference/class/GvrBasePointer有参考是你需要的