/// <summary> /// The GetControllerElementPath returns the path to the game object that the given controller element for the given hand resides in. /// </summary> /// <param name="element">The controller element to look up.</param> /// <param name="hand">The controller hand to look up.</param> /// <param name="fullPath">Whether to get the initial path or the full path to the element.</param> /// <returns>A string containing the path to the game object that the controller element resides in.</returns> public override string GetControllerElementPath(VRTK_ControllerElements element, VRTK_DeviceFinder.ControllerHand hand, bool fullPath = false) { var suffix = (fullPath ? "/attach" : ""); switch (element) { case VRTK_ControllerElements.AttachPoint: return("Model/tip/attach"); case VRTK_ControllerElements.Trigger: return("Model/trigger" + suffix); case VRTK_ControllerElements.GripLeft: return("Model/lgrip" + suffix); case VRTK_ControllerElements.GripRight: return("Model/rgrip" + suffix); case VRTK_ControllerElements.Touchpad: return("Model/trackpad" + suffix); case VRTK_ControllerElements.ApplicationMenu: return("Model/button" + suffix); case VRTK_ControllerElements.SystemMenu: return("Model/sys_button" + suffix); case VRTK_ControllerElements.Body: return("Model/body"); } return(null); }
private Transform GetTransform(Transform setTransform, VRTK_ControllerElements findElement) { Transform returnTransform = null; if (setTransform) { returnTransform = setTransform; } else { var actualController = VRTK_DeviceFinder.GetActualController(controllerActions.gameObject); if (actualController && actualController.activeInHierarchy) { var controllerHand = VRTK_DeviceFinder.GetControllerHand(controllerActions.gameObject); var elementPath = VRTK_SDK_Bridge.GetControllerElementPath(findElement, controllerHand, true); returnTransform = actualController.transform.FindChild(elementPath); } } return(returnTransform); }
public static string GetControllerElementPath(VRTK_ControllerElements element, VRTK_DeviceFinder.ControllerHand hand = VRTK_DeviceFinder.ControllerHand.Right, bool fullPath = false) { return(GetControllerSDK().GetControllerElementPath(element, hand, fullPath)); }
/// <summary> /// The GetControllerElementPath returns the path to the game object that the given controller element for the given hand resides in. /// </summary> /// <param name="element">The controller element to look up.</param> /// <param name="hand">The controller hand to look up.</param> /// <param name="fullPath">Whether to get the initial path or the full path to the element.</param> /// <returns>A string containing the path to the game object that the controller element resides in.</returns> public abstract string GetControllerElementPath(VRTK_ControllerElements element, VRTK_DeviceFinder.ControllerHand hand, bool fullPath = false);
/// <summary> /// The GetControllerElementPath returns the path to the game object that the given controller element for the given hand resides in. /// </summary> /// <param name="element">The controller element to look up.</param> /// <param name="hand">The controller hand to look up.</param> /// <param name="fullPath">Whether to get the initial path or the full path to the element.</param> /// <returns>A string containing the path to the game object that the controller element resides in.</returns> public override string GetControllerElementPath(VRTK_ControllerElements element, VRTK_DeviceFinder.ControllerHand hand, bool fullPath = false) { return(""); }