コード例 #1
0
    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);
    }
コード例 #2
0
        private void OnDestroy()
        {
            StopAllCoroutines();
            Controller controller = _provider.GetLeapController();

            if (controller != null)
            {
                _provider.GetLeapController().DistortionChange -= onDistortionChange;
            }
        }
コード例 #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;
     }
 }
コード例 #4
0
        void OnEnable()
        {
            Controller controller = _provider.GetLeapController();

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

            LeapVRCameraControl.OnLeftPreRender  += ApplyCameraProjectionValues;
            LeapVRCameraControl.OnRightPreRender += ApplyCameraProjectionValues;
        }
コード例 #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
        }
コード例 #6
0
        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);
            }
        }
コード例 #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;
     }
 }
コード例 #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;
        }
コード例 #9
0
 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;
     }
 }
コード例 #10
0
 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());
 }