Esempio n. 1
0
        void ResourcesLoad()
        {
            leapHand = ModuleManager.Instance.GetComponentInChildren <HandModelManager>();
            var hands = leapHand.GetComponentsInChildren <HandModel>(true);

            foreach (var item in hands)
            {
                Debug.Log("" + item.Handedness + " name : " + item.name);
                Rigidhands.Add(item.Handedness, item);
            }

            Rigidhands[Chirality.Left].OnBegin   += OnLeft;
            Rigidhands[Chirality.Left].OnFinish  += OffLeft;
            Rigidhands[Chirality.Right].OnBegin  += OnRight;
            Rigidhands[Chirality.Right].OnFinish += OffRight;

            if (leapHand == null)
            {
                Debug.LogError("module error");
            }
        }
Esempio 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);
        }