Ejemplo n.º 1
0
    private void Awake()
    {
        if (_dataProvider == null)
        {
            _dataProvider = GetComponent <IOVRSkeletonDataProvider>();
        }

        _bones = new List <OVRBone>();
        Bones  = _bones.AsReadOnly();

        _bindPoses = new List <OVRBone>();
        BindPoses  = _bindPoses.AsReadOnly();

        _capsules = new List <OVRBoneCapsule>();
        Capsules  = _capsules.AsReadOnly();
    }
Ejemplo n.º 2
0
        protected override void UpdateData()
        {
            _handDataAsset.Config      = Config;
            _handDataAsset.IsDataValid = true;
            _handDataAsset.IsConnected =
                (OVRInput.GetConnectedControllers() & _ovrController) > 0;

            if (_ovrHand != null)
            {
                IOVRSkeletonDataProvider skeletonProvider = _ovrHand;
                SkeletonPoseData         poseData         = skeletonProvider.GetSkeletonPoseData();
                if (poseData.IsDataValid && poseData.RootScale <= 0.0f)
                {
                    if (_lastHandScale <= 0.0f)
                    {
                        poseData.IsDataValid = false;
                    }
                    else
                    {
                        poseData.RootScale = _lastHandScale;
                    }
                }
                else
                {
                    _lastHandScale = poseData.RootScale;
                }

                if (poseData.IsDataValid && _handDataAsset.IsConnected)
                {
                    UpdateDataPoses(poseData);
                    return;
                }
            }

            // revert state fields to their defaults
            _handDataAsset.IsConnected       = default;
            _handDataAsset.IsTracked         = default;
            _handDataAsset.RootPoseOrigin    = default;
            _handDataAsset.PointerPoseOrigin = default;
            _handDataAsset.IsHighConfidence  = default;
            for (var fingerIdx = 0; fingerIdx < Constants.NUM_FINGERS; fingerIdx++)
            {
                _handDataAsset.IsFingerPinching[fingerIdx]       = default;
                _handDataAsset.IsFingerHighConfidence[fingerIdx] = default;
            }
        }
Ejemplo n.º 3
0
 // Added
 public void SetDataProvider(GameObject hand)
 {
     _dataProvider = hand.GetComponent <IOVRSkeletonDataProvider>();
     Initialize();
 }