public override void Update()
        {
#if UNITY_2017_2_OR_NEWER
            if (tracker == null || !tracker.enabled || !enabled || XRSettings.loadedDeviceName != "OpenVR")
#else
            if (tracker == null || !tracker.enabled || !enabled || VRSettings.loadedDeviceName != "OpenVR")
#endif
            { return; }

            if (viveTracker == null)
            {
                UpdateTarget(hipsTarget.hips.target, sensorTransform);
                return;
            }

            if (viveTracker.trackerId < 0)
            {
                viveTracker.trackerId = FindTorsoTracker();
            }

            viveTracker.UpdateComponent();
            if (viveTracker.status != Status.Tracking)
            {
                return;
            }

            UpdateTarget(hipsTarget.hips.target, viveTracker);
        }
示例#2
0
        public override void Update()
        {
#if UNITY_2017_2_OR_NEWER
            if (tracker == null || !tracker.enabled || !enabled || XRSettings.loadedDeviceName != "OpenVR")
#else
            if (tracker == null || !tracker.enabled || !enabled || VRSettings.loadedDeviceName != "OpenVR")
#endif
            { return; }

            HumanoidTarget.TargetedBone targetBone = handTarget.GetTargetBone(attachedBone);
            if (viveTracker == null)
            {
                UpdateTarget(targetBone.target, sensorTransform);
                return;
            }

            if (viveTracker.trackerId < 0)
            {
                viveTracker.trackerId = FindArmTracker(handTarget.isLeft);
            }

            viveTracker.UpdateComponent();
            if (viveTracker.status != Status.Tracking)
            {
                return;
            }

            UpdateTarget(targetBone.target, viveTracker);
        }