void Start() { initializer = GameObject.FindGameObjectWithTag("initVR"); initVR = initializer.GetComponent <initVR>(); // deviceL = initVR.deviceL; deviceR = initVR.deviceR; a = GetComponent <Renderer>(); bikeTransform = GetComponent <Transform>(); player = GameObject.FindGameObjectWithTag("test"); pMM = player.GetComponent <playerMoveManager>(); // var inputDevices = new List<UnityEngine.XR.InputDevice>(); // var leftHandDevices = new List<UnityEngine.XR.InputDevice>(); // var rightHandDevices = new List<UnityEngine.XR.InputDevice>(); // InputDevices.GetDevices(inputDevices); // foreach (var device in inputDevices) // { // Debug.Log(string.Format("Device found with name '{0}' and role '{1}'", device.name, device.characteristics.ToString())); // } // UnityEngine.XR.InputDevices.GetDevicesAtXRNode(UnityEngine.XR.XRNode.RightHand, rightHandDevices); // if (rightHandDevices.Count == 1) // { // deviceR = rightHandDevices[0]; // Debug.Log(string.Format("Device name '{0}' with role '{1}'", deviceR.name, deviceR.characteristics.ToString())); // } }
void Start() { initializer = GameObject.Find("initVR"); initVR = initializer.GetComponent <initVR>(); // deviceML = initVR.deviceL; // deviceMR = initVR.deviceR; var inputDevices = new List <UnityEngine.XR.InputDevice>(); var leftHandDevices = new List <UnityEngine.XR.InputDevice>(); var rightHandDevices = new List <UnityEngine.XR.InputDevice>(); InputDevices.GetDevices(inputDevices); foreach (var device in inputDevices) { Debug.Log(string.Format("Device found with name '{0}' and role '{1}'", device.name, device.characteristics.ToString())); } UnityEngine.XR.InputDevices.GetDevicesAtXRNode(UnityEngine.XR.XRNode.LeftHand, leftHandDevices); if (leftHandDevices.Count == 1) { deviceML = leftHandDevices[0]; Debug.Log(string.Format("Device name '{0}' with role '{1}'", deviceML.name, deviceML.characteristics.ToString())); } else if (leftHandDevices.Count > 1) { Debug.Log("Found more than one left hand!"); } UnityEngine.XR.InputDevices.GetDevicesAtXRNode(UnityEngine.XR.XRNode.RightHand, rightHandDevices); if (rightHandDevices.Count == 1) { deviceMR = rightHandDevices[0]; Debug.Log(string.Format("Device name '{0}' with role '{1}'", deviceMR.name, deviceMR.characteristics.ToString())); } else if (rightHandDevices.Count > 1) { Debug.Log("Found more than one right hand!"); } }