예제 #1
0
        void Update()
        {
            if (!EditorApplication.isPlaying && SupportsEditorPersistence())
            {
                Transform           editorPoseSpace;
                LeapServiceProvider leapServiceProvider = FindObjectOfType <LeapServiceProvider>();
                LeapTransform       poseTransform       = LeapTransform.Identity;
                if (leapServiceProvider != null)
                {
                    editorPoseSpace = leapServiceProvider.transform;
                    poseTransform   = TestHandFactory.GetTestPoseLeftHandTransform(leapServiceProvider.editTimePose);
                }
                else
                {
                    editorPoseSpace = transform;
                }

                Hand hand = TestHandFactory.MakeTestHand(Handedness == Chirality.Left, poseTransform).TransformedCopy(UnityMatrixExtension.GetLeapMatrix(editorPoseSpace));
                //Hand hand = TestHandFactory.MakeTestHand(0, 0, Handedness == Chirality.Left).TransformedCopy(UnityMatrixExtension.GetLeapMatrix(editorPoseSpace));

                if (GetLeapHand() == null)
                {
                    SetLeapHand(hand);
                    InitHand();
                    BeginHand();
                    UpdateHand();
                }
                else
                {
                    SetLeapHand(hand);
                    UpdateHand();
                }
            }
        }
예제 #2
0
 // Use this for initialization
 void Start()
 {
     prepos     = new Vector3(0f, 0f, 0f);
     preprepos  = new Vector3(0f, 0f, 0f);
     ring_count = 0;
     service    = controller.GetComponent <LeapServiceProvider>();
 }
예제 #3
0
    // Use this for initialization
    void Start()
    {
        ltruth     = GameObject.Find("LeapCalibrationTruthL");
        rtruth     = GameObject.Find("LeapCalibrationTruthR");
        lmeasured  = GameObject.Find("LeapCalibrationMeasuredL");
        rmeasured  = GameObject.Find("LeapCalibrationMeasuredR");
        leapOrigin = GameObject.Find("LeapCalibratedOrigin");

        leapOrigin.transform.SetParent(Camera.main.transform);
        leapOrigin.transform.localPosition = Vector3.zero;
        leapOrigin.transform.localRotation = Quaternion.identity;

        try
        {
            StreamReader reader = new StreamReader("stored_calibration.txt");
            String[]     parts  = reader.ReadToEnd().Split(' ');
            leapOrigin.transform.localPosition = new Vector3(float.Parse(parts[0]), float.Parse(parts[1]), float.Parse(parts[2]));
            leapOrigin.transform.localRotation = new Quaternion(float.Parse(parts[3]), float.Parse(parts[4]), float.Parse(parts[5]), float.Parse(parts[6]));
        } catch (FileNotFoundException e) { }


        foreach (var provider in FindObjectsOfType <Leap.Unity.LeapXRServiceProvider>())
        {
            provider.deviceOrigin     = leapOrigin.transform;
            provider.deviceOffsetMode = Leap.Unity.LeapXRServiceProvider.DeviceOffsetMode.Transform;

            _provider = provider;
        }
    }
예제 #4
0
        // Modifique los accesors para poder overridearlo en HapticHand
        protected virtual void Update()
        {
            if (!EditorApplication.isPlaying && SupportsEditorPersistence())
            {
                Transform           editorPoseSpace;
                LeapServiceProvider leapServiceProvider = FindObjectOfType <LeapServiceProvider>();
                if (leapServiceProvider)
                {
                    editorPoseSpace = leapServiceProvider.transform;
                }
                else
                {
                    editorPoseSpace = transform;
                }

                Hand hand = TestHandFactory.MakeTestHand(0, 0, Handedness == Chirality.Left).TransformedCopy(UnityMatrixExtension.GetLeapMatrix(editorPoseSpace));
                if (GetLeapHand() == null)
                {
                    SetLeapHand(hand);
                    InitHand();
                    BeginHand();
                    UpdateHand();
                }
                else
                {
                    SetLeapHand(hand);
                    UpdateHand();
                }
            }
        }
예제 #5
0
        //private OSCServer myServer;

        //public string outIP = "127.0.0.1";
        //public int outPort = 8765;
        //public int inPort = 5678;
        // Buffer size of the application (stores 100 messages from different servers)
        //public int bufferSize = 100;

        void Start()
        {
            GameObject leapController = GameObject.Find("LeapHandController");

            leapScript = leapController.GetComponent <LeapServiceProvider>();

            // Initialize OSC clients (transmitters)
            OSCHandler.Instance.Init();
        }
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public void Awake()
        {
            if ( CursorDataProvider == null ) {
                CursorDataProvider = FindObjectOfType<HoverCursorDataProvider>();
            }

            if ( LeapServiceProvider == null ) {
                LeapServiceProvider = FindObjectOfType<LeapServiceProvider>();
            }
        }
예제 #7
0
 // Use this for initialization
 void Start()
 {
     pa           = this.GetComponent <PlaneAudio>();
     set          = this.GetComponent <Set>();
     more         = this.transform.Find("morePlane").gameObject;
     prepos       = new Vector3(0f, 0f, 0f);
     preprepos    = new Vector3(0f, 0f, 0f);
     ring_count   = 0;
     service      = controller.GetComponent <LeapServiceProvider>();
     current_time = 0f;
 }
        private void Awake()
        {
            _provider = GetComponent <LeapServiceProvider>();
            if (_provider == null)
            {
                _provider = GetComponentInChildren <LeapServiceProvider>();
            }

            //Enable pooling to reduce overhead of images
            LeapInternal.MemoryManager.EnablePooling = true;

            ApplyGammaCorrectionValues();
        }
        private void OnEnable()
        {
            _provider = GetComponent <LeapServiceProvider>();
            if (_provider == null)
            {
                _provider = GetComponentInChildren <LeapServiceProvider>();
                if (_provider == null)
                {
                    enabled = false;
                    return;
                }
            }

            _provider.OnDeviceSafe += onDevice;
        }
        private static void InitStatic()
        {
            s_provider = GameObject.FindObjectOfType <LeapServiceProvider>();
            Camera providerCamera = s_provider.GetComponentInParent <Camera>();

            if (providerCamera == null)
            {
                return;
            }
            if (providerCamera.transform.parent == null)
            {
                return;
            }
            s_leapRig = providerCamera.transform.parent.gameObject;
        }
예제 #11
0
        void OnEnable()
        {
            if (_provider == null)
            {
                _provider = GameObject.FindObjectOfType <LeapServiceProvider>();
            }
            Controller controller = _provider.GetLeapController();

            if (controller != null)
            {
                onController(controller);
            }
            else
            {
                StartCoroutine(waitForController());
            }

            LeapVRCameraControl.OnLeftPreRender  += ApplyCameraProjectionValues;
            LeapVRCameraControl.OnRightPreRender += ApplyCameraProjectionValues;
        }
예제 #12
0
        private void Awake()
        {
            _provider = GetComponent <LeapServiceProvider>();
            if (_provider == null)
            {
                _provider = GetComponentInChildren <LeapServiceProvider>();
            }

            //Enable pooling to reduce overhead of images
            LeapInternal.MemoryManager.EnablePooling = true;

            ApplyGammaCorrectionValues();
#if UNITY_2019_3_OR_NEWER
            //SRP require subscribing to RenderPipelineManagers
            if (UnityEngine.Rendering.GraphicsSettings.renderPipelineAsset != null)
            {
                UnityEngine.Rendering.RenderPipelineManager.beginCameraRendering -= onBeginRendering;
                UnityEngine.Rendering.RenderPipelineManager.beginCameraRendering += onBeginRendering;
            }
#endif
        }
예제 #13
0
    void Start()
    {
        _provider = FindObjectOfType <Leap.Unity.LeapServiceProvider>();

        if (_provider == null)
        {
            throw new System.Exception("Can't find leap motion provider");
        }

        //_controller = _provider.GetLeapController();
        //_controller.FrameReady += OnFrameReady;

        //if (useFixedUpdate) {
        _provider.OnFixedFrame += OnFrameReady;
        //} else {
        //    _provider.OnUpdateFrame += OnFrameReady;
        //}

        _left        = new HandState();
        _right       = new HandState();
        _right.right = true;
    }
예제 #14
0
 // Use this for initialization
 void Start()
 {
     sp = obj.GetComponent <LeapServiceProvider>();
 }