コード例 #1
0
        private void Awake()
        {
            userRig = GetComponentInParent <UserRig>();
            skeletalControllerHand = GetComponent <SkeletalControllerHand>();

            ProviderSwitcher providerSwitcher = userRig.ProviderSwitcher;

            // get all of our handed stuff
            // break into the model manager
            handModelManagers = userRig.GetComponentsInChildren <HandModelManager>(true);

            FieldInfo[] privateFields = typeof(HandModelManager).GetFields(BindingFlags.Instance | BindingFlags.NonPublic);
            modelGroupField = privateFields.First <FieldInfo>(item => item.Name == "ModelPool");
            modelGroupLists = new List <HandModelManager.ModelGroup> [handModelManagers.Length];

            // we need our datahands
            foreach (HandModelManager modelManager in handModelManagers)
            {
                DataHand[] dataHands = modelManager.GetComponentsInChildren <DataHand>(true);

                if (dataHands != null && dataHands.Length == 2)
                {
                    Chirality chirality = (IsLeft) ? Chirality.Left : Chirality.Right;
                    dataHand = dataHands.First(item => item is DataHand && item.Handedness == chirality);
                }
                else
                {
                    continue;
                }
            }

            GetModelGroupLists();
        }
コード例 #2
0
ファイル: UserRig.cs プロジェクト: jcorvinus/HandshakeVR
        private void Awake()
        {
            instance = this;

            UserHand[] hands = GetComponentsInChildren <UserHand>(true);

            leftHand  = hands.First <UserHand>(item => item.IsLeft);
            rightHand = hands.First <UserHand>(item => !item.IsLeft);

            GetHandPoints();

            providerSwitcher = GetComponentInChildren <ProviderSwitcher>();
            platformManager  = providerSwitcher.GetComponent <PlatformManager>();
        }
コード例 #3
0
        private void Awake()
        {
            PlatformInfo platform = platforms.First(item => item.Platform == PlatformID.SteamVR);

            currentPlatform = platform;
            switcher        = GetComponent <ProviderSwitcher>();

            leftControllers  = platform.Controllers.Where(item => item.isLeft).ToArray();
            rightControllers = platform.Controllers.Where(item => item.isRight).ToArray();

            InteractionHand[] hands = GetComponentsInChildren <InteractionHand>(true);
            leftHand  = hands.First(item => item.isLeft);
            rightHand = hands.First(item => item.isRight);

            leftDisableContactTimer  = disableContactAfterGraspTime;
            rightDisableContactTimer = disableContactAfterGraspTime;

            instance = this;
        }
コード例 #4
0
        /*private bool _graspButtonDown = false;
         * private bool _graspButtonUp = false;
         * private float _graspButtonDownSlopTimer = 0F;*/

        private void Awake()
        {
            SkeletalControllerHand[] controllerHands = FindObjectsOfType <SkeletalControllerHand>();

            foreach (SkeletalControllerHand controllerHand in controllerHands)
            {
                if (controllerHand.IsLeft == _isLeft)
                {
                    skeletalControllerHand = controllerHand;
                    break;
                }
            }

            steamVRRemapper = skeletalControllerHand.GetComponent <SteamVRRemapper>();
            _graspManipulatorPoints.Add(position);

            disableContactTimer = disableContactAfterGraspTime;
            _contactBones       = new ContactBone[] { };

            switcher = FindObjectOfType <ProviderSwitcher>();
        }
コード例 #5
0
        private void Awake()
        {
            SkeletalControllerHand[] controllerHands = FindObjectsOfType <SkeletalControllerHand>();

            foreach (SkeletalControllerHand controllerHand in controllerHands)
            {
                if (controllerHand.IsLeft == _isLeft)
                {
                    skeletalControllerHand = controllerHand;
                    break;
                }
            }

            steamVRRemapper = skeletalControllerHand.GetComponent <SteamVRRemapper>();
            _graspManipulatorPoints.Add(position);

            _contactBones = new ContactBone[] { };

            primaryHoverPoints.Add(skeletalControllerHand.IndexMetacarpal.GetChild(0).GetChild(0).GetChild(0));

            switcher          = FindObjectOfType <ProviderSwitcher>();
            pinchGrabDetector = GetComponent <PinchDetector>();
        }