コード例 #1
0
ファイル: HandVRSphereHand.cs プロジェクト: NON906/HandMR
        void Update()
        {
            for (int loop = 0; loop < 5; loop++)
            {
                bool opened;

                bool fullTracking = true;
                for (int loop2 = 0; loop2 < 4; loop2++)
                {
                    if (fingers_[loop * 4 + loop2 + 1].GetComponent <HandVRPosition>().PhysicEnabled == false)
                    {
                        fullTracking = false;
                        break;
                    }
                }

                if (fullTracking)
                {
                    opened = calcFingerOpened(fingers_[loop * 4 + 2].position - fingers_[loop * 4 + 1].position,
                                              fingers_[loop * 4 + 4].position - fingers_[loop * 4 + 3].position,
                                              0.5f);
                }
                else
                {
                    opened = false;
                }

                fingerTracking_[loop] = fullTracking;
                fingerOpened_[loop]   = opened;
            }

            if (IsTrackingHand)
            {
                int id = handVRMain_.GetIdFromHandednesses(ThisEitherHand);
                if (id >= 0)
                {
                    HandDirection = handVRMain_.GetHandDirection(id);
                }
            }

            inputUpdate();
        }