Ejemplo n.º 1
0
        private void Awake()
        {
            PlatformInfo platform = platforms.First(item => item.Platform == PlatformID.SteamVR);

            currentPlatform = platform;

            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;
        }
Ejemplo n.º 2
0
        private void Awake()
        {
            platformManager    = GetComponent <PlatformManager>();
            interactionManager = Leap.Unity.Interaction.InteractionManager.instance;
            if (interactionManager != null)
            {
                controllerManager = interactionManager.GetComponent <PlatformControllerManager>();
            }

            DataHand[] dataHands = modelManager.GetComponentsInChildren <DataHand>(true);

            leftAbstractHand  = (HandModelBase)dataHands.First(item => item is DataHand && item.Handedness == Chirality.Left);
            rightAbstractHand = (HandModelBase)dataHands.First(item => item is DataHand && item.Handedness == Chirality.Right);

            if (interactionManager)
            {
                foreach (InteractionController controller in interactionManager.interactionControllers)
                {
                    if (controller is InteractionHand)
                    {
                        InteractionHand hand = (InteractionHand)controller;

                        if (hand.isLeft)
                        {
                            leftInteractionHand = hand;
                        }
                        else
                        {
                            rightInteractionHand = hand;
                        }

                        hand.leapProvider = defaultProvider;
                    }
                }
            }

            SkeletalControllerHand[] hands = transform.parent.GetComponentsInChildren <SkeletalControllerHand>(true);
            leftSkeletalControllerHand  = hands.First(item => item.IsLeft);
            rightSkeletalControllerHand = hands.First(item => !item.IsLeft);
        }
Ejemplo n.º 3
0
        private void Awake()
        {
            userRig            = GetComponentInParent <UserRig>();
            platformManager    = GetComponent <PlatformManager>();
            interactionManager = Leap.Unity.Interaction.InteractionManager.instance;
            if (interactionManager != null)
            {
                controllerManager = interactionManager.GetComponent <PlatformControllerManager>();
            }

            if (interactionManager)
            {
                foreach (InteractionController controller in interactionManager.interactionControllers)
                {
                    if (controller is InteractionHand)
                    {
                        InteractionHand hand = (InteractionHand)controller;

                        if (hand.isLeft)
                        {
                            leftInteractionHand = hand;
                        }
                        else
                        {
                            rightInteractionHand = hand;
                        }

                        hand.leapProvider = defaultProvider;
                    }
                }
            }

            SkeletalControllerHand[] hands = transform.parent.GetComponentsInChildren <SkeletalControllerHand>(true);
            leftSkeletalControllerHand  = hands.First(item => item.IsLeft);
            rightSkeletalControllerHand = hands.First(item => !item.IsLeft);
        }