protected long ImageTimeout = 9000; //microseconds

    void Start()
    {
        //SET UP CONTROLLER
        leap_controller_ = leap_provider.GetLeapController();
        //TELL IT WE'RE ASKING FOR IMAGES
        //leap_controller_.SetPolicy(Controller.PolicyFlag.POLICY_BACKGROUND_FRAMES);
        //SET BYTE ARRAYS
        SetDimensions(Width, Height);
    }
        private void OnDestroy()
        {
            StopAllCoroutines();
            Controller controller = _provider.GetLeapController();

            if (controller != null)
            {
                _provider.GetLeapController().DistortionChange -= onDistortionChange;
            }
        }
Exemplo n.º 3
0
 protected void Start()
 {
     if (provider.IsConnected())
     {
         deviceInfo = provider.GetDeviceInfo();
         _shouldSetLocalPosition = true;
         LeapVRCameraControl.OnValidCameraParams += onValidCameraParams;
     }
     else
     {
         StartCoroutine(waitForConnection());
         Controller controller = provider.GetLeapController();
         controller.Device += OnDevice;
     }
 }
        void OnEnable()
        {
            Controller controller = _provider.GetLeapController();

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

            LeapVRCameraControl.OnLeftPreRender  += ApplyCameraProjectionValues;
            LeapVRCameraControl.OnRightPreRender += ApplyCameraProjectionValues;
        }
Exemplo n.º 5
0
        private void OnDestroy()
        {
            StopAllCoroutines();
            Controller controller = _provider.GetLeapController();

            if (controller != null)
            {
                _provider.GetLeapController().DistortionChange -= onDistortionChange;
            }
#if UNITY_2019_3_OR_NEWER
            //SRP require subscribing to RenderPipelineManagers
            if (UnityEngine.Rendering.GraphicsSettings.renderPipelineAsset != null)
            {
                UnityEngine.Rendering.RenderPipelineManager.beginCameraRendering -= onBeginRendering;
            }
#endif
        }
        private void updateHistory()
        {
            long leapNow = provider.GetLeapController().Now();

            _history.Add(new TransformData()
            {
                leapTime      = leapNow,
                localPosition = InputTracking.GetLocalPosition(VRNode.CenterEye),
                localRotation = InputTracking.GetLocalRotation(VRNode.CenterEye)
            });

            // Reduce history length
            while (_history.Count > 0 &&
                   MAX_LATENCY < leapNow - _history[0].leapTime)
            {
                _history.RemoveAt(0);
            }
        }
Exemplo n.º 7
0
 protected void Start()
 {
     if (provider.IsConnected())
     {
         deviceInfo = provider.GetDeviceInfo();
         LeapVRCameraControl.OnValidCameraParams += onValidCameraParams;
         if (deviceInfo.type == LeapDeviceType.Invalid)
         {
             Debug.LogWarning("Invalid Leap Device -> enabled = false");
             enabled = false;
             return;
         }
     }
     else
     {
         Controller controller = provider.GetLeapController();
         controller.Device += OnDevice;
     }
 }
Exemplo n.º 8
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;
        }
 protected void Start()
 {
     if (provider.IsConnected())
     {
         deviceInfo = provider.GetDeviceInfo();
         _shouldSetLocalPosition = true;
         LeapVRCameraControl.OnValidCameraParams += onValidCameraParams;
         if (deviceInfo.type == LeapDeviceType.Invalid)
         {
             Debug.LogWarning("Invalid Leap Device -> enabled = false");
             enabled = false;
             return;
         }
     }
     else
     {
         StartCoroutine(waitForConnection());
         Controller controller = provider.GetLeapController();
         controller.Device += OnDevice;
     }
 }
 void OnEnable()
 {
     _provider.GetLeapController().DistortionChange += onDistortionChange;
     _provider.GetLeapController().Connect          += delegate {
         _provider.GetLeapController().Config.Get("images_mode", (Int32 enabled) => {
             this.ImagesEnabled = enabled == 0 ? false : true;
         });
     };
     StartCoroutine(CheckImageMode());
 }