Ejemplo n.º 1
0
        protected void OnDevice(object sender, DeviceEventArgs args)
        {
            deviceInfo = provider.GetDeviceInfo();
            _shouldSetLocalPosition = true;

            //Get a callback right as rendering begins for this frame so we can update the history and warping.
            LeapVRCameraControl.OnValidCameraParams -= onValidCameraParams; //avoid multiple subscription
            LeapVRCameraControl.OnValidCameraParams += onValidCameraParams;
        }
Ejemplo n.º 2
0
    void Start() {
#if UNITY_EDITOR
      if (!Application.isPlaying) {
        return;
      }
#endif

      _deviceInfo = new LeapDeviceInfo(LeapDeviceType.Peripheral);
    }
Ejemplo n.º 3
0
        void Start()
        {
#if UNITY_EDITOR
            if (!Application.isPlaying)
            {
                return;
            }
#endif

            _deviceInfo = LeapDeviceInfo.GetLeapDeviceInfo();
        }
Ejemplo n.º 4
0
        void Start()
        {
#if UNITY_EDITOR
            if (!Application.isPlaying)
            {
                return;
            }
#endif

            _deviceInfo = new LeapDeviceInfo(LeapDeviceType.Peripheral);
        }
Ejemplo n.º 5
0
 protected void OnDevice(object sender, DeviceEventArgs args)
 {
     deviceInfo = provider.GetDeviceInfo();
     if (deviceInfo.type == LeapDeviceType.Invalid)
     {
         Debug.LogWarning("Invalid Leap Device -> enabled = false");
         enabled = false;
         return;
     }
     //Get a callback right as rendering begins for this frame so we can update the history and warping.
     LeapVRCameraControl.OnValidCameraParams -= onValidCameraParams; //avoid multiple subscription
     LeapVRCameraControl.OnValidCameraParams += onValidCameraParams;
 }
        protected void Start()
        {
            //Get a callback right as rendering begins for this frame so we can update the history and warping.
            LeapVRCameraControl.OnValidCameraParams += onValidCameraParams;

            deviceInfo = provider.GetDeviceInfo();
            if (deviceInfo.type == LeapDeviceType.Invalid)
            {
                Debug.LogWarning("Invalid Leap Device -> enabled = false");
                enabled = false;
                return;
            }
        }
Ejemplo n.º 7
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;
     }
 }
Ejemplo n.º 8
0
        /** Returns information describing the device hardware. */
        public LeapDeviceInfo GetDeviceInfo()
        {
            //return new LeapDeviceInfo();
            if (_overrideDeviceType)
            {
                return(new LeapDeviceInfo(_overrideDeviceTypeWith));
            }

            DeviceList devices = GetLeapController().Devices;

            Debug.Log("Device count is: " + devices.Count);
            if (devices.Count == 1)
            {
                LeapDeviceInfo info = new LeapDeviceInfo(LeapDeviceType.Peripheral);
                // TODO: DeviceList does not tell us the device type. Dragonfly serial starts with "LE" and peripheral starts with "LP"
                if (devices[0].SerialNumber.Length >= 2)
                {
                    switch (devices[0].SerialNumber.Substring(0, 2))
                    {
                    case ("LP"):
                        info = new LeapDeviceInfo(LeapDeviceType.Peripheral);
                        break;

                    case ("LE"):
                        info = new LeapDeviceInfo(LeapDeviceType.Dragonfly);
                        break;

                    default:
                        break;
                    }
                }

                // TODO: Add baseline & offset when included in API
                // NOTE: Alternative is to use device type since all parameters are invariant
                info.isEmbedded          = devices[0].IsEmbedded;
                info.horizontalViewAngle = devices[0].HorizontalViewAngle * Mathf.Rad2Deg;
                info.verticalViewAngle   = devices[0].VerticalViewAngle * Mathf.Rad2Deg;
                info.trackingRange       = devices[0].Range / 1000f;
                info.serialID            = devices[0].SerialNumber;
                return(info);
            }
            else if (devices.Count > 1)
            {
                return(new LeapDeviceInfo(LeapDeviceType.Peripheral));
            }
            return(new LeapDeviceInfo(LeapDeviceType.Invalid));
        }
Ejemplo n.º 9
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;
     }
 }
 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;
     }
 }
 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;
       }
 }
        protected void OnDevice(object sender, DeviceEventArgs args)
        {
            deviceInfo = provider.GetDeviceInfo();
              _shouldSetLocalPosition = true;

              if (deviceInfo.type == LeapDeviceType.Invalid) {
            Debug.LogWarning("Invalid Leap Device -> enabled = false");
            enabled = false;
            return;
              }
              //Get a callback right as rendering begins for this frame so we can update the history and warping.
              LeapVRCameraControl.OnValidCameraParams -= onValidCameraParams; //avoid multiple subscription
              LeapVRCameraControl.OnValidCameraParams += onValidCameraParams;
        }
   protected void Start() {
     //Get a callback right as rendering begins for this frame so we can update the history and warping.
     LeapVRCameraControl.OnValidCameraParams += onValidCameraParams;
 
     deviceInfo = provider.GetDeviceInfo();
     if (deviceInfo.type == LeapDeviceType.Invalid) {
       Debug.LogWarning("Invalid Leap Device -> enabled = false");
       enabled = false;
       return;
     }
   }
        /** Returns information describing the device hardware. */
        public LeapDeviceInfo GetDeviceInfo()
        {
            if (_overrideDeviceType) {
            return new LeapDeviceInfo(_overrideDeviceTypeWith);
              }

              DeviceList devices = GetLeapController().Devices;
              if (devices.Count == 1) {
            LeapDeviceInfo info = new LeapDeviceInfo(LeapDeviceType.Peripheral);
            // TODO: DeviceList does not tell us the device type. Dragonfly serial starts with "LE" and peripheral starts with "LP"
            if (devices[0].SerialNumber.Length >= 2) {
              switch (devices[0].SerialNumber.Substring(0, 2)) {
            case ("LP"):
              info = new LeapDeviceInfo(LeapDeviceType.Peripheral);
              break;
            case ("LE"):
              info = new LeapDeviceInfo(LeapDeviceType.Dragonfly);
              break;
            default:
              break;
              }
            }

            // TODO: Add baseline & offset when included in API
            // NOTE: Alternative is to use device type since all parameters are invariant
            info.isEmbedded = devices[0].IsEmbedded;
            info.horizontalViewAngle = devices[0].HorizontalViewAngle * Mathf.Rad2Deg;
            info.verticalViewAngle = devices[0].VerticalViewAngle * Mathf.Rad2Deg;
            info.trackingRange = devices[0].Range / 1000f;
            info.serialID = devices[0].SerialNumber;
            return info;
              } else if (devices.Count > 1) {
            return new LeapDeviceInfo(LeapDeviceType.Peripheral);
              }
              return new LeapDeviceInfo(LeapDeviceType.Invalid);
        }
 /** Returns information describing the device hardware. */
 public LeapDeviceInfo GetDeviceInfo()
 {
     return(LeapDeviceInfo.GetLeapDeviceInfo());
 }