Example #1
0
 public PokeXRInputDevices(bool _debugMode)
 {
     debugMode = _debugMode;
     InputDevices.GetDevices(XRInputDevices);
     PokeXRInputTracking = new PokeXRInputTracking(debugMode);
     PokeXRInputTracking.refreshInputDevices();
     if (debugMode)
     {
         for (i = 0; i < XRInputDevices.Count; i++)
         {
             List <InputFeatureUsage> ifu = new List <InputFeatureUsage>();
             string a = "XRInputDevice " + i + ": " + XRInputDevices[i].name + ", isValid: " + XRInputDevices[i].isValid;
             XRInputDevices[i].TryGetFeatureUsages(ifu);
             for (int j = 0; j < ifu.Count; j++)
             {
                 a += "\nfu = " + ifu[j].name;
             }
             Debug.Log(a);
         }
         Debug.Log(PokeXRInputTracking.toString());
     }
     if (XRInputDevices.Count > 0)
     {
         Player1InputDevice = XRInputDevices[0];
         Player1Body        = PokeXRInputTracking.getPokeBody();
         pokeXRDeviceBody   = PokeXRInputTracking.getPokeDeviceBody();
     }
     else
     {
         Debug.LogWarning("Failed to detect and");
     }
 }
 private void getVRStuff()
 {
     player1Body = pokeXR.GetPokeXRDeviceBody();
     //test it
     if (!player1Body.hasHead && !player1Body.hasLeftHand && !player1Body.hasRightHand)
     {
         Debug.LogError("Failed to get player 1 head");
     }
     else
     {
         DO("Successfully got player 1 body");
     }
 }
Example #3
0
            public PokeXRDeviceBody getPokeDeviceBody()
            {
                PokeXRDeviceBody pokeXRDeviceBody = new PokeXRDeviceBody {
                };
                var devices = new List <InputDevice>();

                InputDevices.GetDevicesAtXRNode(XRNode.LeftHand, devices);
                if (devices.Count == 1)
                {
                    pokeXRDeviceBody.LeftHand    = devices[0];
                    pokeXRDeviceBody.hasLeftHand = true;
                    Debug.Log(string.Format("Device name '{0}' with role '{1}'", devices[0].name, devices[0].role.ToString()));
                }
                else if (devices.Count > 1)
                {
                    Debug.LogError("Found more than one left hand!");
                }
                InputDevices.GetDevicesAtXRNode(XRNode.RightHand, devices);
                if (devices.Count == 1)
                {
                    pokeXRDeviceBody.RightHand    = devices[0];
                    pokeXRDeviceBody.hasRightHand = true;
                    Debug.Log(string.Format("Device name '{0}' with role '{1}'", devices[0].name, devices[0].role.ToString()));
                }
                else if (devices.Count > 1)
                {
                    Debug.LogError("Found more than one left hand!");
                }
                InputDevices.GetDevicesAtXRNode(XRNode.Head, devices);
                if (devices.Count == 1)
                {
                    pokeXRDeviceBody.Head    = devices[0];
                    pokeXRDeviceBody.hasHead = true;
                    Debug.Log(string.Format("Device name '{0}' with role '{1}'", devices[0].name, devices[0].role.ToString()));
                }
                else if (devices.Count > 1)
                {
                    Debug.LogError("Found more than one left hand!");
                }

                return(pokeXRDeviceBody);
            }