Example #1
0
 // Use this for initialization
 void Start()
 {
     provider     = FindObjectOfType <LeapProvider>() as LeapProvider;
     newFluids    = FindObjectOfType <Fluids>() as Fluids;
     position     = new Vector3(0, 0, 0);
     isClosedFist = false;
 }
Example #2
0
        private void Awake()
        {
            if (!Application.isPlaying)
            {
                return;
            }

            init = false;

            if (leapProvider == null)
            {
                //Try to set the provider for the user
                leapProvider = Hands.Provider;

                if (leapProvider == null)
                {
                    Debug.LogError("No leap provider found in the scene, hand model has been disabled", this.gameObject);
                    this.enabled = false;
                    this.gameObject.SetActive(false);
                    return;
                }
            }

            if (HandModelType == ModelType.Graphics)
            {
                leapProvider.OnUpdateFrame -= UpdateFrame;
                leapProvider.OnUpdateFrame += UpdateFrame;
            }

            else
            {
                leapProvider.OnFixedFrame -= FixedUpdateFrame;
                leapProvider.OnFixedFrame += FixedUpdateFrame;
            }
        }
Example #3
0
        protected virtual void OnEnable()
        {
            provider = requireComponent <Leap.Hololens.LeapServiceProvider>();
            pool     = requireComponent <HandPool>();

            provider.OnUpdateFrame += OnUpdateFrame;
            provider.OnFixedFrame  += OnFixedFrame;
        }
Example #4
0
        protected virtual void OnEnable()
        {
            provider = requireComponent <LeapProvider>();
            factory  = requireComponent <HandFactory>();

            provider.OnUpdateFrame += OnUpdateFrame;
            provider.OnFixedFrame  += OnFixedFrame;
        }
 private void validateInput()
 {
     if (detectCycle())
     {
         _inputLeapProvider = null;
         Debug.LogError("The input to the post-process provider on " + gameObject.name
                        + " causes an infinite cycle, so its input has been set to null.");
     }
 }
        protected virtual void Start()
        {
            Factory = requireComponent <HandFactory>();

            //Felix
            if (Provider == null)
            {
                Provider = GetComponent <LeapProvider>();
            }
        }
Example #7
0
        void Update()
        {
            if (!EditorApplication.isPlaying && SupportsEditorPersistence())
            {
                LeapProvider provider = null;

                //First try to get the provider from a parent HandModelManager
                if (transform.parent != null)
                {
                    var manager = transform.parent.GetComponent <HandModelManager>();
                    if (manager != null)
                    {
                        provider = manager.leapProvider;
                    }
                }

                //If not found, use any old provider from the Hands.Provider getter
                if (provider == null)
                {
                    provider = Hands.Provider;
                }

                Hand hand = null;
                //If we found a provider, pull the hand from that
                if (provider != null)
                {
                    var frame = provider.CurrentFrame;

                    if (frame != null)
                    {
                        hand = frame.Get(Handedness);
                    }
                }

                //If we still have a null hand, construct one manually
                if (hand == null)
                {
                    hand = TestHandFactory.MakeTestHand(Handedness == Chirality.Left, unitType: TestHandFactory.UnitType.LeapUnits);
                    hand.Transform(transform.GetLeapMatrix());
                }

                if (GetLeapHand() == null)
                {
                    SetLeapHand(hand);
                    InitHand();
                    BeginHand();
                    UpdateHand();
                }
                else
                {
                    SetLeapHand(hand);
                    UpdateHand();
                }
            }
        }
        protected virtual void OnEnable()
        {
            if (_leapProvider == null)
            {
                _leapProvider = Hands.Provider;
            }

            _leapProvider.OnUpdateFrame -= OnUpdateFrame;
            _leapProvider.OnUpdateFrame += OnUpdateFrame;

            _leapProvider.OnFixedFrame -= OnFixedFrame;
            _leapProvider.OnFixedFrame += OnFixedFrame;
        }
Example #9
0
 private bool detectCycle()
 {
     LeapProvider providerA = _inputLeapProvider, providerB = _inputLeapProvider;
     while (providerA is PostProcessProvider)
     {
         providerB = (providerB as PostProcessProvider).inputLeapProvider;
         if (providerA == providerB) { return true; }
         else if (!(providerB is PostProcessProvider)) { return false; }
         providerA = (providerA as PostProcessProvider).inputLeapProvider;
         providerB = (providerB as PostProcessProvider).inputLeapProvider;
         if (!(providerB is PostProcessProvider)) { return false; }
     }
     return false;
 }
Example #10
0
        public static Hand Get(this LeapProvider provider, Chirality whichHand)
        {
            Frame frame;

            if (Time.inFixedTimeStep)
            {
                frame = provider.CurrentFixedFrame;
            }
            else
            {
                frame = provider.CurrentFrame;
            }

            return(frame.GetHand(whichHand));
        }
Example #11
0
        protected virtual void Start()
        {
            //provider = requireComponent<LeapProvider>();
            factory = requireComponent <HandFactory>();

            //Felix
            if (provider == null)
            {
                provider = GetComponent <LeapProvider>();
            }
            //Felix

            /*if (Player == null)
             * {
             *  Player = GetComponent<LeapPlayer>();
             * }*/
        }
Example #12
0
        protected virtual void OnEnable()
        {
            provider = requireComponent <LeapProvider>();

            provider.OnUpdateFrame += OnUpdateFrame;
            provider.OnFixedFrame  += OnFixedFrame;

            laction = ActionType.Null;
            raction = ActionType.Null;

            for (int i = 0; i < TYPES; i++)
            {
                List <double> lnewList = new List <double>();
                lcount.Add(lnewList);
                List <double> rnewList = new List <double>();
                rcount.Add(rnewList);
            }
        }
Example #13
0
        protected virtual void OnEnable()
        {
            //追加
            if (isMain)
            {
                _mains.Add(this);
            }
            _all.Add(this);
            if (_leapProvider == null)
            {
                _leapProvider = Hands.Provider;
            }

            _leapProvider.OnUpdateFrame -= OnUpdateFrame;
            _leapProvider.OnUpdateFrame += OnUpdateFrame;

            _leapProvider.OnFixedFrame -= OnFixedFrame;
            _leapProvider.OnFixedFrame += OnFixedFrame;
        }
Example #14
0
        private static void InitStatic()
        {
            s_provider = GameObject.FindObjectOfType <LeapProvider>();
            if (s_provider == null)
            {
                return;
            }
            Camera providerCamera = s_provider.GetComponentInParent <Camera>();

            if (providerCamera == null)
            {
                return;
            }
            if (providerCamera.transform.parent == null)
            {
                return;
            }
            s_leapRig = providerCamera.transform.parent.gameObject;
        }
Example #15
0
        private void OnEnable()
        {
            if (_provider == null)
            {
                _provider = Hands.Provider;
            }

            if (_frameRateText == null)
            {
                _frameRateText = GetComponentInChildren <TextMesh>();
                if (_frameRateText == null)
                {
                    Debug.LogError("Could not enable FpsLabel because no TextMesh was specified!");
                    enabled = false;
                }
            }

            _smoothedRenderFps.delay = 0.3f;
            _smoothedRenderFps.reset = true;
        }
 protected virtual void Start()
 {
     provider = requireComponent <LeapProvider>();
     factory  = requireComponent <HandFactory>();
 }
Example #17
0
 public static Leap.Hand MakeTestHand(this LeapProvider provider, bool isLeft)
 {
     return(TestHandFactory.MakeTestHand(isLeft, Hands.Provider.editTimePose)
            .Transform(UnityMatrixExtension.GetLeapMatrix(Hands.Provider.transform)));
 }
Example #18
0
 // Use this for initialization
 void Start()
 {
     light    = GetComponent <Light>();
     provider = FindObjectOfType <LeapProvider>() as LeapProvider;
     Color.RGBToHSV(light.color, out hue, out sat, out val);
 }