コード例 #1
0
    void Start()
    {
        upperYBoundries = 580;
        underYboundries = -580f;

        provider = FindObjectOfType <LeapServiceProvider>() as LeapServiceProvider;
    }
コード例 #2
0
 private void Start()
 {
     leapControllerProvider = leapController.GetComponent <LeapServiceProvider>();
     buttonAudioSource      = GetComponent <AudioSource>();
     freeMode.startFreeMode();
     recordingControls.enabled = false;
 }
コード例 #3
0
    // Update is called once per frame
    void Update()
    {
        m_Provider = m_ProviderObject.GetComponent <LeapServiceProvider>();

        frame = m_Provider.CurrentFrame;

        // 右手の諸々の情報を取得
        if (rightHand != null)
        {
            // 手のひらの法線
            common.normalRight = common.rightHand.PalmNormal.ToVector3();
            // 手の位置
            common.positionRight = common.rightHand.PalmPosition.ToVector3();
            // 指の方向?
            common.directionRight = common.rightHand.Direction.ToVector3();
            // 手の速度
            common.velocityRight = common.rightHand.PalmVelocity.ToVector3();
        }

        // 左手の諸々の情報を取得
        if (leftHand != null)
        {
            // 左手の手のひらの法線
            common.normalLeft = common.leftHand.PalmNormal.ToVector3();
            // 左手の位置
            common.positionLeft = common.leftHand.PalmPosition.ToVector3();
            // 左手の指の方向
            common.directionLeft = common.leftHand.Direction.ToVector3();
            // 左手の速度
            common.velocityLeft = common.leftHand.PalmVelocity.ToVector3();
        }
    }
コード例 #4
0
 // Use this for initialization
 void Start()
 {
     this.m_Provider         = GameObject.Find("LeapHandController").GetComponent <LeapServiceProvider>();
     this.camera             = GameObject.Find("Main Camera").GetComponent <Camera>();
     this.originLightningObj = GameObject.Find("LightningFinger");
     this.baseEulerAngle     = new Vector3(270, 90, 0); //基底となるオイラー角(左手の指先が上,親指が右の状態)
 }
コード例 #5
0
    private void Awake()
    {
        if (sInstance == null)
        {
            sInstance = this;
        }
        else
        {
            Destroy(this);
        }

        m_LeftDetection  = new DetectionHand();
        m_RightDetection = new DetectionHand();

        m_LeapService = FindObjectOfType <LeapServiceProvider>();

        bool[] leftBools  = LeftActivationFingers.GetAsArray();
        bool[] rightBools = RightActivationFingers.GetAsArray();

        for (int i = 0; i < leftBools.Length; i++)
        {
            EFinger SelectedFinger = EFinger.eThumb + i;
            if (leftBools[i])
            {
                m_LeftFingerCollisions.Add(SelectedFinger, CreateCollisionSphere());
            }

            if (rightBools[i])
            {
                m_RightFingerCollisions.Add(SelectedFinger, CreateCollisionSphere());
            }
        }
    }
コード例 #6
0
        // Use this for initialization
        void Start()
        {
            //Application.targetFrameRate = 60;
            NetworkDataProvider = Resources.FindObjectsOfTypeAll <LeapStreamingProvider>()[0];
            LeapDataProvider    = Resources.FindObjectsOfTypeAll <LeapServiceProvider>()[0];

            switch (FrameEncodingType)
            {
            case FrameEncodingEnum.VectorHand:
                playerState = new VectorFrameEncoding();
                NetworkDataProvider.lerpState    = new VectorFrameEncoding();
                NetworkDataProvider.prevState    = new VectorFrameEncoding();
                NetworkDataProvider.currentState = new VectorFrameEncoding();
                break;

            case FrameEncodingEnum.CurlHand:
                playerState = new CurlFrameEncoding();
                NetworkDataProvider.lerpState    = new CurlFrameEncoding();
                NetworkDataProvider.prevState    = new CurlFrameEncoding();
                NetworkDataProvider.currentState = new CurlFrameEncoding();
                break;

            default:
                playerState = new VectorFrameEncoding();
                NetworkDataProvider.lerpState    = new VectorFrameEncoding();
                NetworkDataProvider.prevState    = new VectorFrameEncoding();
                NetworkDataProvider.currentState = new VectorFrameEncoding();
                break;
            }

            playerState.fillEncoding(handData);
        }
コード例 #7
0
    private void Init()
    {
        GameObject obj = new GameObject();

        obj.name = "LeapServiceProvider";
        lsp      = obj.AddComponent <LeapServiceProvider>();
        DontDestroyOnLoad(lsp);
    }
コード例 #8
0
    public bool PointerActive = true;         //!< check if pointer is Active

    void Start()
    {
        provider = FindObjectOfType <LeapServiceProvider>() as LeapServiceProvider;
        GameObject go = new GameObject();

        line = go.AddComponent <LineRenderer>();
        go.SetActive(false);
    }
コード例 #9
0
 // Start is called before the first frame update
 void Start()
 {
     if (_KeyboardLocation == null)
     {
         _KeyboardLocation = this;
     }
     provider = FindObjectOfType <LeapServiceProvider>() as LeapServiceProvider;
 }
コード例 #10
0
    void Awake()
    {
        InitHand();
        ChangeHandType(HandType);

        controller = FindObjectOfType <LeapHandController>();
        provider   = FindObjectOfType <LeapServiceProvider>();
    }
コード例 #11
0
        /// <summary>
        /// Set the Leap hands required for retrieving joint pose data.  A Leap AttachmentHand contains AttachmentPointFlags which are equivalent to
        /// MRTK's TrackedHandJoint.  The Leap AttachmentHand contains all joint poses for a hand except the metacarpals.  The Leap Hand is
        /// used to retrieve the metacarpal joint poses.
        /// </summary>
        internal void SetAttachmentHands(AttachmentHand attachmentHandLeap, LeapServiceProvider leapMotionServiceProvider)
        {
            // Set the leap attachment hand with the corresponding handedness
            attachmentHand = attachmentHandLeap;

            // Cache a reference to the leap service provider which is used to gather the metacarpal joint data each frame
            leapServiceProvider = leapMotionServiceProvider;
        }
コード例 #12
0
        // Use this for initialization
        void Start()
        {
            //Application.targetFrameRate = 60;
            if (isLocalPlayer)
            {
                switch (frameEncodingType)
                {
                case FrameEncodingEnum.VectorHand:
                    playerState = new VectorFrameEncoding();
                    break;

                case FrameEncodingEnum.CurlHand:
                    playerState = new CurlFrameEncoding();
                    break;

                default:
                    playerState = new VectorFrameEncoding();
                    break;
                }
                //LeapDataProvider = HandController.gameObject.AddComponent<LeapServiceProvider>();
                leapDataProvider = handController.gameObject.AddComponent <LeapXRServiceProvider>();
                //ENABLE THESE AGAIN ONCE THE SERVICE HAS THESE EXPOSED SOMEHOW
                //LeapDataProvider._temporalWarping = HandController.parent.GetComponent<LeapVRTemporalWarping>();
                //LeapDataProvider._temporalWarping.provider = LeapDataProvider;
                //LeapDataProvider._isHeadMounted = true;
                //LeapDataProvider.UpdateHandInPrecull = true;
            }
            else
            {
                networkDataProvider = handController.gameObject.AddComponent <LeapStreamingProvider>();
                //Destroy(handController.parent.GetComponent<LeapXRTemporalWarping>());
                switch (frameEncodingType)
                {
                case FrameEncodingEnum.VectorHand:
                    playerState = new VectorFrameEncoding();
                    networkDataProvider.lerpState    = new VectorFrameEncoding();
                    networkDataProvider.prevState    = new VectorFrameEncoding();
                    networkDataProvider.currentState = new VectorFrameEncoding();
                    break;

                case FrameEncodingEnum.CurlHand:
                    playerState = new CurlFrameEncoding();
                    networkDataProvider.lerpState    = new CurlFrameEncoding();
                    networkDataProvider.prevState    = new CurlFrameEncoding();
                    networkDataProvider.currentState = new CurlFrameEncoding();
                    break;

                default:
                    playerState = new VectorFrameEncoding();
                    networkDataProvider.lerpState    = new VectorFrameEncoding();
                    networkDataProvider.prevState    = new VectorFrameEncoding();
                    networkDataProvider.currentState = new VectorFrameEncoding();
                    break;
                }
            }
            //handController.gameObject.AddComponent<LeapHandController>();
            playerState.fillEncoding(null);
        }
コード例 #13
0
        private void FindController()
        {
            LeapServiceProvider provider = FindObjectOfType <LeapServiceProvider>();

            if (provider != null)
            {
                m_controller = provider.GetLeapController();
            }
        }
コード例 #14
0
ファイル: test.cs プロジェクト: sweetpand/Hadwriting-repo
    // Use this for initialization
    void Start()
    {
        controller = new Controller();

        leapProvider = FindObjectOfType <LeapServiceProvider> ();
        wordList     = new List <string> ();
        wordID       = -1;
        buildFiles();
    }
コード例 #15
0
    private void Start()
    {
        leapProvider = FindObjectOfType <LeapServiceProvider>();

        Konekcija();

        udpSend.Init();
        udpReceive.Init();
    }
コード例 #16
0
 // Use this for initialization
 void Start()
 {
     leap             = FindObjectOfType <LeapServiceProvider>() as LeapServiceProvider;
     v1               = new Vector2();
     v2               = new Vector2();
     leftHand         = new Hand();
     leftHand.IsLeft  = true;
     rightHand        = new Hand();
     rightHand.IsLeft = false;
 }
コード例 #17
0
    void Start()
    {
        provider     = FindObjectOfType <LeapServiceProvider>() as LeapServiceProvider;
        finger_index = new Dictionary <Finger.FingerType, int> ();

        finger_index.Add(Finger.FingerType.TYPE_INDEX, 0);
        finger_index.Add(Finger.FingerType.TYPE_MIDDLE, 1);
        finger_index.Add(Finger.FingerType.TYPE_RING, 2);
        finger_index.Add(Finger.FingerType.TYPE_PINKY, 3);
    }
コード例 #18
0
    // Use this for initialization
    void Start()
    {
        provider = FindObjectOfType <LeapServiceProvider>() as LeapServiceProvider;

        if (!isDebug)
        {
            player.parent = stage;
            player.GetComponent <Rigidbody>().isKinematic = true;
        }
    }
コード例 #19
0
ファイル: LeapController.cs プロジェクト: yoon1012/OculusLeap
    // Use this for initialization
    void Start()
    {
        provider   = FindObjectOfType <LeapServiceProvider>() as LeapServiceProvider;
        controller = provider.GetLeapController();

        deviceState = DeviceState.Disconnected;
        handState   = HandState.None;
        leftHand    = null;
        rightHand   = null;
    }
コード例 #20
0
    public void OnEnable()
    {
        try
        {
            if (!SuperController.singleton.IsMonitorOnly)
            {
                enabled = false;
                return;
            }

            var centerCamera = SuperController.singleton.MonitorCenterCamera;
            if (centerCamera == null)
            {
                throw new NullReferenceException(nameof(centerCamera));
            }
            var handModelManager = SuperController.singleton.leapHandModelControl.GetComponent <HandModelManager>();
            if (handModelManager == null)
            {
                throw new NullReferenceException(nameof(handModelManager));
            }

            _handsRig = new GameObject("DesktopLeapHandsRig");
            _handsRig.transform.SetParent(centerCamera.transform, false);
            _handsRig.transform.localPosition = new Vector3(_handsOffsetX.val, _handsOffsetY.val, _handsOffsetZ.val);

            _handsContainer = new GameObject("DesktopLeapHandsContainer");
            _handsContainer.transform.SetParent(_handsRig.transform, false);
            _handsContainer.transform.localEulerAngles = new Vector3(_handsRotateX.val, _handsRotateY.val, _handsRotateZ.val);

            _provider = _handsContainer.AddComponent <LeapServiceProvider>();
            handModelManager.leapProvider = _provider;

            _originalLeftHand          = SuperController.singleton.leftHand;
            _originalLeftHandParent    = _originalLeftHand.parent;
            _originalRightHand         = SuperController.singleton.rightHand;
            _originalRightHandParent   = _originalLeftHand.parent;
            _handDisableFakeTargetLeft = new GameObject("DesktopLeapFakeLeftHand");
            _handDisableFakeTargetLeft.transform.SetParent(_originalLeftHand, false);
            SuperController.singleton.leftHand = _handDisableFakeTargetLeft.transform;
            _handDisableFakeTargetRight        = new GameObject("DesktopLeapFakeRightHand");
            _handDisableFakeTargetRight.transform.SetParent(_originalRightHand, false);
            SuperController.singleton.rightHand = _handDisableFakeTargetRight.transform;
            _originalLeftHand.gameObject.SetActive(true);
            _originalRightHand.gameObject.SetActive(true);
            _originalLeftHand.SetParent(SuperController.singleton.leapHandMountLeft, false);
            _originalRightHand.SetParent(SuperController.singleton.leapHandMountRight, false);

            SuperController.singleton.transform.parent.BroadcastMessage("DevToolsGameObjectExplorerShow", _originalLeftHand.transform.gameObject);
        }
        catch (Exception e)
        {
            SuperController.LogError($"{nameof(DesktopLeap)}.{nameof(OnEnable)}: {e}");
        }
    }
コード例 #21
0
 // Use this for initialization
 void Start()
 {
     leapServiceProvider = FindObjectOfType <LeapServiceProvider> ();
     menuOn      = false;
     menu        = GameObject.Find("Menu");
     menuPointer = GameObject.Find("Pointer");
     fingerFinal = GameObject.Find("FingerPointer");
     option1     = GameObject.Find("Option1");
     option2     = GameObject.Find("Option2");
     option3     = GameObject.Find("Option3");
 }
コード例 #22
0
 private void Awake()
 {
     if (leapService == null)
     {
         leapService = GetComponentInChildren <LeapServiceProvider>();
     }
     if (handModelManager == null)
     {
         handModelManager = GetComponentInChildren <HandModelManager>();
     }
 }
コード例 #23
0
ファイル: Detector.cs プロジェクト: YaxuanDai/LeapMotionGrasp
    // Use this for initialization
    void Start()
    {
        provider = FindObjectOfType <LeapServiceProvider>() as LeapServiceProvider;
        lastL    = lastR = false;
        holdL    = holdR = unholdL = unholdR = 0;

        pLeft  = left.transform.position;
        pRight = right.transform.position;

        startEpoch2 = false;
    }
コード例 #24
0
        public float ExtendFingertipDistance = 0;         //TODO: test this


        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public void Awake()
        {
            if (CursorDataProvider == null)
            {
                CursorDataProvider = FindObjectOfType <HoverCursorDataProvider>();
            }

            if (LeapServiceProvider == null)
            {
                LeapServiceProvider = FindObjectOfType <LeapServiceProvider>();
            }
        }
コード例 #25
0
 private void Init()
 {
     this.m_Provider  = this.leapProviderObj.GetComponent <LeapServiceProvider>();
     this.mode        = PINCH_MOVE;
     this.isOpenHands = new bool[2] {
         false, false
     };
     this.insideBuilding  = GameObject.Find("Building/Inside");
     this.outsideBuilding = GameObject.Find("Building/Outside");
     this.garden          = GameObject.Find("Garden");
     this.usedImpact      = false;
 }
コード例 #26
0
        protected virtual void Start()
        {
            _provider = _provider ?? FindObjectOfType <LeapServiceProvider>();

            _texture            = new Texture2D(_historyLength, 1, TextureFormat.Alpha8, false, true);
            _texture.filterMode = FilterMode.Point;
            _texture.wrapMode   = TextureWrapMode.Clamp;
            _colors             = new Color32[_historyLength];

            _graphRenderer.material.SetTexture("_GraphTexture", _texture);

            _stopwatch.Start();
        }
コード例 #27
0
        void Start()
        {
            handPoseRecognition     = new HandPoseRecognition();
            leapServiceProvider     = FindObjectOfType <LeapServiceProvider>();
            leftGestureRecognition  = new SimpleGestureRecognition(gestureTimeRate);
            rightGestureRecognition = new SimpleGestureRecognition(gestureTimeRate);
            bimanualRecognition     = new SimpleGestureRecognition(gestureTimeRate);
            leftHandPose            = HandPoseType.Unknown;
            rightHandPose           = HandPoseType.Unknown;

            InitUnimanualGestures();
            InitBimanualGestures();
        }
コード例 #28
0
    private void OnEnable()
    {
        if (_leapProvider == null)
        {
            _leapProvider = FindObjectOfType <LeapServiceProvider>();
            if (_leapProvider == null)
            {
                Debug.LogError("Couldn't find LeapServiceProvider");
                return;
            }
        }

        RegistorationLeapEvents();
    }
コード例 #29
0
 private void Init()
 {
     this.m_Provider        = this.leapProviderObj.GetComponent <LeapServiceProvider>();
     this.handUtil          = new HandUtil();
     this.IsFingerEffector  = false;
     this.curAttractorIndex = 0;
     this.attractorHandId   = this.IsAttractorOnLeftHand ? HandUtil.LEFT : HandUtil.RIGHT;
     this.effectorHandId    = this.IsAttractorOnLeftHand ? HandUtil.RIGHT : HandUtil.LEFT;
     for (int i = 0; i < this.attractorScales.Count; i++)
     {
         float s = this.attractorScales[i];
         attractors[i].transform.localScale = new Vector3(s, s, s);
     }
     this.previousHands = new Hand[2];
 }
コード例 #30
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public void Awake()
        {
            CursorUtil.FindCursorReference(this, ref CursorDataProvider, false);

            if (LeapServiceProvider == null)
            {
                LeapServiceProvider = FindObjectOfType <LeapServiceProvider>();
            }

            if (Look.FollowTransform == null)
            {
                GameObject lookGo = GameObject.Find("CenterEyeAnchor");
                Look.FollowTransform = (lookGo == null ? null : lookGo.transform);
            }
        }