protected virtual void SetCachedControllerType(string givenType) { givenType = givenType.ToLower(); //try direct matching switch (givenType) { case "googledaydream": cachedControllerType = ControllerType.Daydream_Controller; return; } //fallback to fuzzy matching if (givenType.Contains("openvr controller")) { switch (VRTK_DeviceFinder.GetHeadsetType()) { case SDK_BaseHeadset.HeadsetType.HTCVive: cachedControllerType = ControllerType.SteamVR_ViveWand; break; case SDK_BaseHeadset.HeadsetType.OculusRift: cachedControllerType = ControllerType.SteamVR_OculusTouch; break; } } else if (givenType.Contains("oculus touch")) { cachedControllerType = ControllerType.Oculus_OculusTouch; } }
// Token: 0x06001344 RID: 4932 RVA: 0x0006BCD4 File Offset: 0x00069ED4 protected virtual string GetControllerStartMenuPath(SDK_BaseController.ControllerHand hand, string suffix) { VRTK_DeviceFinder.Headsets headsetType = VRTK_DeviceFinder.GetHeadsetType(true); if (headsetType != VRTK_DeviceFinder.Headsets.OculusRift) { return(null); } return(((hand == SDK_BaseController.ControllerHand.Left) ? "enter_button" : "home_button") + suffix); }
private string GetControllerButtonOnePath(ControllerHand hand, string suffix) { switch (VRTK_DeviceFinder.GetHeadsetType(true)) { case VRTK_DeviceFinder.Headsets.Vive: return(null); case VRTK_DeviceFinder.Headsets.OculusRift: return((hand == ControllerHand.Left ? "x_button" : "a_button") + suffix); } return(null); }
private string GetControllerTouchpadPath(ControllerHand hand, string suffix) { switch (VRTK_DeviceFinder.GetHeadsetType(true)) { case VRTK_DeviceFinder.Headsets.Vive: return("trackpad" + suffix); case VRTK_DeviceFinder.Headsets.OculusRift: return("thumbstick" + suffix); } return(null); }
private string GetControllerGripPath(ControllerHand hand, string suffix, ControllerHand forceHand) { switch (VRTK_DeviceFinder.GetHeadsetType(true)) { case VRTK_DeviceFinder.Headsets.Vive: return((forceHand == ControllerHand.Left ? "lgrip" : "rgrip") + suffix); case VRTK_DeviceFinder.Headsets.OculusRift: return("grip" + suffix); } return(null); }
private string GetControllerSystemMenuPath(ControllerHand hand, string suffix) { switch (VRTK_DeviceFinder.GetHeadsetType(true)) { case VRTK_DeviceFinder.Headsets.Vive: return("sys_button" + suffix); case VRTK_DeviceFinder.Headsets.OculusRift: return((hand == ControllerHand.Left ? "enter_button" : "home_button") + suffix); } return(null); }
// Token: 0x06001342 RID: 4930 RVA: 0x0006BC54 File Offset: 0x00069E54 protected virtual string GetControllerButtonTwoPath(SDK_BaseController.ControllerHand hand, string suffix) { VRTK_DeviceFinder.Headsets headsetType = VRTK_DeviceFinder.GetHeadsetType(true); if (headsetType == VRTK_DeviceFinder.Headsets.OculusRift) { return(((hand == SDK_BaseController.ControllerHand.Left) ? "y_button" : "b_button") + suffix); } if (headsetType == VRTK_DeviceFinder.Headsets.Vive) { return("button" + suffix); } return(null); }
// Token: 0x06001340 RID: 4928 RVA: 0x0006BBE8 File Offset: 0x00069DE8 protected virtual string GetControllerTouchpadPath(SDK_BaseController.ControllerHand hand, string suffix) { VRTK_DeviceFinder.Headsets headsetType = VRTK_DeviceFinder.GetHeadsetType(true); if (headsetType == VRTK_DeviceFinder.Headsets.OculusRift) { return("thumbstick" + suffix); } if (headsetType == VRTK_DeviceFinder.Headsets.Vive) { return("trackpad" + suffix); } return(null); }
// Token: 0x0600133F RID: 4927 RVA: 0x0006BBA8 File Offset: 0x00069DA8 protected virtual string GetControllerGripPath(SDK_BaseController.ControllerHand hand, string suffix, SDK_BaseController.ControllerHand forceHand) { VRTK_DeviceFinder.Headsets headsetType = VRTK_DeviceFinder.GetHeadsetType(true); if (headsetType == VRTK_DeviceFinder.Headsets.OculusRift) { return("grip" + suffix); } if (headsetType == VRTK_DeviceFinder.Headsets.Vive) { return(((forceHand == SDK_BaseController.ControllerHand.Left) ? "lgrip" : "rgrip") + suffix); } return(null); }
// Token: 0x06001320 RID: 4896 RVA: 0x0006B3E0 File Offset: 0x000695E0 public override SDK_BaseController.ControllerType GetCurrentControllerType() { VRTK_DeviceFinder.Headsets headsetType = VRTK_DeviceFinder.GetHeadsetType(true); if (headsetType == VRTK_DeviceFinder.Headsets.OculusRift) { return(SDK_BaseController.ControllerType.SteamVR_OculusTouch); } if (headsetType == VRTK_DeviceFinder.Headsets.Vive) { return(SDK_BaseController.ControllerType.SteamVR_ViveWand); } return(SDK_BaseController.ControllerType.Custom); }
// Token: 0x06001326 RID: 4902 RVA: 0x0006B620 File Offset: 0x00069820 public override Transform GenerateControllerPointerOrigin(GameObject parent) { VRTK_DeviceFinder.Headsets headsetType = VRTK_DeviceFinder.GetHeadsetType(true); if (headsetType == VRTK_DeviceFinder.Headsets.OculusRift && (this.IsControllerLeftHand(parent) || this.IsControllerRightHand(parent))) { GameObject gameObject = new GameObject(parent.name + " _CustomPointerOrigin"); gameObject.transform.SetParent(parent.transform); gameObject.transform.localEulerAngles = new Vector3(40f, 0f, 0f); gameObject.transform.localPosition = new Vector3(this.IsControllerLeftHand(parent) ? 0.0081f : -0.0081f, -0.0273f, -0.0311f); return(gameObject.transform); } return(null); }
protected virtual void SetControllerButtons(ControllerHand hand) { List <string> checkhands = (hand == ControllerHand.Right ? validRightHands : validLeftHands); bool joystickFound = false; int validJoystickIndex = 0; string[] availableJoysticks = Input.GetJoystickNames(); for (int i = 0; i < availableJoysticks.Length; i++) { if (checkhands.Contains(availableJoysticks[i])) { SetCachedControllerType(availableJoysticks[i]); joystickFound = true; validJoystickIndex = i + 1; } } //If the joystick isn't found then try and match on headset type if (!joystickFound) { switch (VRTK_DeviceFinder.GetHeadsetType()) { case SDK_BaseHeadset.HeadsetType.GoogleDaydream: SetCachedControllerType("googledaydream"); joystickFound = true; validJoystickIndex = 1; break; } } if (joystickFound) { if (hand == ControllerHand.Right) { var pressCodes = cachedControllerType == ControllerType.Oculus_OculusRemote ? rightOculusRemotePressCodes : rightControllerPressCodes; SetControllerButtonValues(ref rightControllerTouchKeyCodes, ref rightControllerPressKeyCodes, validJoystickIndex, rightControllerTouchCodes, pressCodes); } else { SetControllerButtonValues(ref leftControllerTouchKeyCodes, ref leftControllerPressKeyCodes, validJoystickIndex, leftControllerTouchCodes, leftControllerPressCodes); } } else if (availableJoysticks.Length > 0 && VRTK_ControllerReference.GetControllerReference(hand) != null && VRTK_ControllerReference.GetControllerReference(hand).actual.gameObject.activeInHierarchy) { VRTK_Logger.Warn("Failed setting controller buttons on [" + hand + "] due to no valid joystick type found in `GetJoyStickNames` -> " + string.Join(", ", availableJoysticks)); } }
/// <summary> /// The GetControllerDefaultColliderPath returns the path to the prefab that contains the collider objects for the default controller of this SDK. /// </summary> /// <param name="hand">The controller hand to check for</param> /// <returns>A path to the resource that contains the collider GameObject.</returns> public override string GetControllerDefaultColliderPath(ControllerHand hand) { var returnCollider = "ControllerColliders/Fallback"; switch (VRTK_DeviceFinder.GetHeadsetType(true)) { case VRTK_DeviceFinder.Headsets.OculusRift: returnCollider = (hand == ControllerHand.Left ? "ControllerColliders/SteamVROculusTouch_Left" : "ControllerColliders/SteamVROculusTouch_Right"); break; case VRTK_DeviceFinder.Headsets.Vive: returnCollider = "ControllerColliders/HTCVive"; break; } return(returnCollider); }
/// <summary> /// The GenerateControllerPointerOrigin method can create a custom pointer origin Transform to represent the pointer position and forward. /// </summary> /// <param name="parent">The GameObject that the origin will become parent of. If it is a controller then it will also be used to determine the hand if required.</param> /// <returns>A generated Transform that contains the custom pointer origin.</returns> public override Transform GenerateControllerPointerOrigin(GameObject parent) { switch (VRTK_DeviceFinder.GetHeadsetType(true)) { case VRTK_DeviceFinder.Headsets.OculusRift: if (IsControllerLeftHand(parent) || IsControllerRightHand(parent)) { var generatedOrigin = new GameObject(parent.name + " _CustomPointerOrigin"); generatedOrigin.transform.SetParent(parent.transform); generatedOrigin.transform.localEulerAngles = new Vector3(40f, 0f, 0f); generatedOrigin.transform.localPosition = new Vector3((IsControllerLeftHand(parent) ? 0.0081f : -0.0081f), -0.0273f, -0.0311f); return(generatedOrigin.transform); } break; } return(null); }
// Token: 0x06001321 RID: 4897 RVA: 0x0006B404 File Offset: 0x00069604 public override string GetControllerDefaultColliderPath(SDK_BaseController.ControllerHand hand) { string result = "ControllerColliders/Fallback"; VRTK_DeviceFinder.Headsets headsetType = VRTK_DeviceFinder.GetHeadsetType(true); if (headsetType != VRTK_DeviceFinder.Headsets.OculusRift) { if (headsetType == VRTK_DeviceFinder.Headsets.Vive) { result = "ControllerColliders/HTCVive"; } } else { result = ((hand == SDK_BaseController.ControllerHand.Left) ? "ControllerColliders/SteamVROculusTouch_Left" : "ControllerColliders/SteamVROculusTouch_Right"); } return(result); }
protected virtual void ToggleOnHeadset() { if (headsetType != SDK_BaseHeadset.HeadsetType.Undefined && headsetType == VRTK_DeviceFinder.GetHeadsetType()) { ToggleObject(); } }