public PokeXRBody getPokeBody() { PokeXRBody pokeXRBody = new PokeXRBody { }; bool hasHead = false, hasLeftHand = false, hasRightHand = false; for (int i = 0; i < xRNodeStates.Count; i++) { if (xRNodeStates[i].nodeType == XRNode.Head) { pokeXRBody.Head = xRNodeStates[i]; hasHead = true; } else if (xRNodeStates[i].nodeType == XRNode.LeftHand) { pokeXRBody.LeftHand = xRNodeStates[i]; hasLeftHand = true; } else if (xRNodeStates[i].nodeType == XRNode.RightHand) { pokeXRBody.RightHand = xRNodeStates[i]; hasRightHand = true; } } pokeXRBody.hasHead = hasHead; pokeXRBody.hasLeftHand = hasLeftHand; pokeXRBody.hasRightHand = hasRightHand; pokeXRBody.isValid = hasHead || hasLeftHand || hasRightHand; return(pokeXRBody); }
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"); } }