public static void DeactivateControllerLabel(ControllerHand hand, ControllerInputUI controllerPart) { if (_DeactivateControllerLabel != null) { _DeactivateControllerLabel(hand, controllerPart); } }
public Device(SteamVR_TrackedObject controller) { this.controller = controller; // TODO: Add Runtime Configuration of ChordingButton's used mask = new ChordMask(new ChordButtonID[] { ChordButtonID.Pie_0_0, ChordButtonID.Pie_0_1, ChordButtonID.Pie_0_2, ChordButtonID.Pie_1_0, ChordButtonID.Pie_1_1, ChordButtonID.Pie_1_2, }); ControllerHand hand = HandForName(controller.name); //trigger = (hand == ControllerHand.L ? ChordButtonID.Trigger_0 : ChordButtonID.Trigger_1); // TODO: Factor out index calculation touches = new List <Vector2>(); touchpad = new TouchpadButtonMask4((int)hand); Debug.Log("Mask Config: " + mask.StringFor(mask.All)); Debug.Log(string.Join("\n", new[] { controller.name + " setup as " + hand.ToString(), //"Trigger => " + trigger.ToString(), "Touchpad => " + mask.StringFor(touchpad.All), })); }
public static void ActivateControllerLabel(ControllerHand hand, ControllerInputUI controllerPart, string text, float duration, int priority) { if (_ActivateControllerLabel != null) { _ActivateControllerLabel(hand, controllerPart, text, duration, priority); } }
/// <summary> /// Called when trigger down /// </summary> /// <param name="c">Controller ID</param> public static void TriggerDown(ControllerHand c) { if (OnTriggerDown != null) { OnTriggerDown(c); } }
IEnumerator Vibrate(float frequency, float amplitude, float duration, ControllerHand hand) { #if OCULUS_INTEGRATION // Start vibration if (hand == ControllerHand.Right) { OVRInput.SetControllerVibration(frequency, amplitude, OVRInput.Controller.RTouch); } else if (hand == ControllerHand.Left) { OVRInput.SetControllerVibration(frequency, amplitude, OVRInput.Controller.LTouch); } yield return(new WaitForSeconds(duration)); // Stop vibration if (hand == ControllerHand.Right) { OVRInput.SetControllerVibration(0, 0, OVRInput.Controller.RTouch); } else if (hand == ControllerHand.Left) { OVRInput.SetControllerVibration(0, 0, OVRInput.Controller.LTouch); } #else yield return(new WaitForSeconds(duration)); #endif }
/// <summary> /// Input up is used less often I find so it gets its own function /// </summary> /// <param name="inputButton"></param> /// <param name="hand"></param> /// <returns></returns> public bool GetInputUp(ButtonTypes inputButton, ControllerHand hand) { if (inputButton == ButtonTypes.Grip) { if (hand == ControllerHand.Left) { return(LeftGripUp); } else { return(RightGripUp); } } else if (inputButton == ButtonTypes.Trigger) { if (hand == ControllerHand.Left) { return(LeftTriggerUp); } else { return(RightTriggerUp); } } else if (inputButton == ButtonTypes.Primary) { if (hand == ControllerHand.Left) { return(LeftPrimaryButtonUp); } else { return(RightPrimaryButtonUp); } } else if (inputButton == ButtonTypes.Secondary) { if (hand == ControllerHand.Left) { return(LeftSecondaryButtonUp); } else { return(RightSecondaryButtonUp); } } else if (inputButton == ButtonTypes.Stick) { if (hand == ControllerHand.Left) { return(LeftStickUp); } else { return(RightStickUp); } } return(false); }
/// <summary> /// Called when Trackpad value changed /// </summary> /// <param name="c">Controller ID</param> public static void TrackpadValue(ControllerHand c, Vector2 value) { if (OnTrackpadValue != null) { OnTrackpadValue(c, value); } }
private void Start() { int i = 0; hand = GetComponent <Controller>().Hand; parabolas = new Transform[GetComponentsInChildren <CurvedLinePoint>().Length]; parabolaParent = GetComponentInChildren <CurvedLineRenderer>().gameObject; // The parent of all the little parabola objects contain the curvedlinerenderer foreach (CurvedLinePoint c in GetComponentsInChildren <CurvedLinePoint>()) { parabolas[i] = c.transform; i++; } if (parabolas == null) { Debug.LogError("No Curved line points are attatched to this object " + transform.name); } LineRend = GetComponentInChildren <LineRenderer>(); if (LineRend == null) { Debug.LogError("No Curved line are attatched to this object " + transform.name); } LineRend.startColor = ValidColor; LineRend.endColor = ValidColor; TeleportArrowMat.SetColor("_BaseColor", ValidColor); print("linerend " + LineRend.name); }
// Token: 0x06005546 RID: 21830 RVA: 0x001D6850 File Offset: 0x001D4C50 public static void VRC_Tutorial_DeactivateControllerLabel(ControllerHand hand, ControllerInputUI controllerPart) { if (TutorialManager.Instance != null) { TutorialManager.Instance.DeactivateControllerLabel(hand, controllerPart); } }
/// <summary> /// Called when trigger Up /// </summary> /// <param name="c">Controller ID</param> public static void TriggerUp(ControllerHand c) { if (OnTriggerUp != null) { OnTriggerUp(c); } }
/// <summary> /// The GetControllerModel method returns the model alias for the given controller hand. /// </summary> /// <param name="hand">The hand enum of which controller model to retrieve.</param> /// <returns>The GameObject that has the model alias within it.</returns> public override GameObject GetControllerModel(ControllerHand hand) { GameObject model = GetSDKManagerControllerModelForHand(hand); if (model == null) { GameObject controller = null; switch (hand) { case ControllerHand.Left: controller = GetControllerLeftHand(true); break; case ControllerHand.Right: controller = GetControllerRightHand(true); break; } if (controller != null) { model = controller.transform.Find("Model").gameObject; } } return(model); }
public override void OnBecomesClosestRemoteGrabbable(ControllerHand touchingHand) { if (HighlightOnRemoteGrabbable) { HighlightItem(); } }
public override void OnNoLongerClosestRemoteGrabbable(ControllerHand touchingHand) { if (HighlightOnRemoteGrabbable) { UnhighlightItem(); } }
// Token: 0x06005545 RID: 21829 RVA: 0x001D682E File Offset: 0x001D4C2E public static void VRC_Tutorial_ActivateControllerLabel(ControllerHand hand, ControllerInputUI controllerPart, string text, float duration, int priority) { if (TutorialManager.Instance != null) { TutorialManager.Instance.ActivateControllerLabel(hand, controllerPart, text, duration, priority); } }
/// <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(ControllerElements element, ControllerHand hand, bool fullPath = false) { string suffix = (fullPath ? "/attach" : ""); switch (element) { case ControllerElements.AttachPoint: return(""); case ControllerElements.Trigger: return("" + suffix); case ControllerElements.GripLeft: return("" + suffix); case ControllerElements.GripRight: return("" + suffix); case ControllerElements.Touchpad: return("" + suffix); case ControllerElements.ButtonOne: return("" + suffix); case ControllerElements.SystemMenu: return("" + suffix); case ControllerElements.Body: return(""); } return(null); }
void doHaptics(ControllerHand touchingHand) { if (input) { input.VibrateController(VibrateFrequency, VibrateAmplitude, VibrateDuration, touchingHand); } }
public override void OnBecomesClosestRemoteGrabbable(ControllerHand touchingHand) { if (HapticsOnValidRemotePickup) { doHaptics(touchingHand); } }
// Token: 0x060056F7 RID: 22263 RVA: 0x001DF33B File Offset: 0x001DD73B public override ControllerUI GetControllerUI(ControllerHand hand) { if (hand == ControllerHand.None) { return(null); } return((hand != ControllerHand.Left) ? this._rightControllerUI : this._leftControllerUI); }
/// <summary> /// Data transformation, encapsulating key values as apis /// </summary> private void TransformData(ControllerHand hand, int handId, int[] data) { var offset = handId == 1 ? 67 : 0; hand.TouchPadPosition.x = data[0 + offset]; hand.TouchPadPosition.y = data[5 + offset]; TransSingleKey(hand.Home, 10 + offset, data); TransSingleKey(hand.App, 15 + offset, data); TransSingleKey(hand.Touch, 20 + offset, data); TransSingleKey(hand.VolumeUp, 25 + offset, data); TransSingleKey(hand.VolumeDown, 30 + offset, data); TransSingleKey(hand.Trigger, 35 + offset, data); if (controllerlink.goblinserviceStarted && !controllerlink.neoserviceStarted) { hand.TriggerNum = controllerlink.GetHBKeyValue(); } if (!controllerlink.goblinserviceStarted && controllerlink.neoserviceStarted) { hand.TriggerNum = controllerlink.GetCVTriggerValue(handId); } hand.Battery = data[40 + offset]; if (data.Length == 47) { hand.SwipeDirection = (SwipeDirection)data[45]; hand.TouchPadClick = (TouchPadClick)data[46]; } else { switch (handId) { case 0: TransSingleKey(hand.X, 45 + offset, data); TransSingleKey(hand.Y, 50 + offset, data); TransSingleKey(hand.Left, 60 + offset, data); break; case 1: TransSingleKey(hand.A, 45 + offset, data); TransSingleKey(hand.B, 50 + offset, data); TransSingleKey(hand.Right, 55 + offset, data); break; } hand.SwipeDirection = (SwipeDirection)data[65 + offset]; hand.TouchPadClick = (TouchPadClick)data[66 + offset]; } hand.GripValue = controllerlink.GetNeo3GripValue(handId); var touchData = controllerlink.GetNeo3TouchData(handId); TransformTouchData(hand, handId, touchData); }
// Token: 0x06005569 RID: 21865 RVA: 0x001D7898 File Offset: 0x001D5C98 private void EnableControllerVisibility(ControllerHand hand, bool enable) { ControllerUI controllerUI = VRCTrackingManager.GetControllerUI(hand); if (controllerUI != null) { controllerUI.EnableVisibility(enable); } }
/// <summary> /// Called if this is the closest grabbable but wasn't in the previous frame /// </summary> /// <param name="touchingHand"></param> public override void OnBecomesClosestGrabbable(ControllerHand touchingHand) { base.OnBecomesClosestGrabbable(touchingHand); if (onBecomesClosestGrabbable != null) { onBecomesClosestGrabbable.Invoke(); } }
/// <summary> /// Fires if this was the closest remote grabbable last frame, but not this frame /// </summary> /// <param name="touchingHand"></param> public override void OnNoLongerClosestRemoteGrabbable(ControllerHand touchingHand) { base.OnNoLongerClosestRemoteGrabbable(touchingHand); if (onNoLongerClosestRemoteGrabbable != null) { onNoLongerClosestRemoteGrabbable.Invoke(); } }
/// <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(ControllerElements element, ControllerHand hand, bool fullPath = false) { switch (element) { case ControllerElements.AttachPoint: return("AttachPoint"); } return(""); }
/// <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) { if (HasAvatar()) { return("ControllerColliders/OculusTouch_" + hand.ToString()); } return("ControllerColliders/Fallback"); }
public Pvr_ControllerLink(string name) { gameobjname = name; hummingBirdMac = ""; hummingBirdRSSI = 0; StartHummingBirdService(); Controller0 = new ControllerHand(); Controller1 = new ControllerHand(); }
/// <summary> /// The GetControllerModel method returns the model alias for the given controller hand. /// </summary> /// <param name="hand">The hand enum of which controller model to retrieve.</param> /// <returns>The GameObject that has the model alias within it.</returns> public override GameObject GetControllerModel(ControllerHand hand) { var model = GetSDKManagerControllerModelForHand(hand); if (!model) { model = GameObject.Find("DaydreamCameraRig/GvrControllerPointer/Controller"); //TODO: CAMERA_RIG constant at top? } return(model); }
// Token: 0x06005578 RID: 21880 RVA: 0x001D7EB4 File Offset: 0x001D62B4 public void DeactivateControllerLabels(ControllerHand hand) { foreach (TutorialManager.ActiveLabel activeLabel in this._activeLabels.Values) { if (activeLabel.Type == TutorialLabelType.Controller && activeLabel.Hand == hand) { this.DeactivateLabel(activeLabel); } } }
// Token: 0x06005575 RID: 21877 RVA: 0x001D7AF4 File Offset: 0x001D5EF4 public void DeactivateControllerLabel(ControllerHand hand, ControllerInputUI controllerPart) { foreach (TutorialManager.ActiveLabel activeLabel in this._activeLabels.Values) { if (activeLabel.Type == TutorialLabelType.Controller && activeLabel.Hand == hand && activeLabel.ControllerPart == controllerPart && activeLabel.Label.IsActive) { this.DeactivateLabel(activeLabel); } } }
// Token: 0x0600557D RID: 21885 RVA: 0x001D80B4 File Offset: 0x001D64B4 private bool ShouldShowControllerUI(ControllerHand hand) { foreach (TutorialManager.ActiveLabel activeLabel in this._activeLabels.Values) { if (activeLabel.Type == TutorialLabelType.Controller && activeLabel.Hand == hand && activeLabel.Label.IsActive) { return(true); } } return(false); }
// Token: 0x060056CC RID: 22220 RVA: 0x001DDBBC File Offset: 0x001DBFBC public static ControllerUI GetControllerUI(ControllerHand hand) { foreach (VRCTracking vrctracking in VRCTrackingManager.instance.activeTrackers) { ControllerUI controllerUI = vrctracking.GetControllerUI(hand); if (controllerUI != null) { return(controllerUI); } } return(null); }
public static bool IsControllerOfHand(GameObject checkController, ControllerHand hand) { var controllerManager = GameObject.FindObjectOfType<SteamVR_ControllerManager>(); if (hand == ControllerHand.Left && controllerManager && controllerManager.left == checkController) { return true; } if (hand == ControllerHand.Right && controllerManager && controllerManager.right == checkController) { return true; } return false; }
/// <summary> /// The IsControllerOfHand method is used to check if a given controller game object is of the hand type provided. /// </summary> /// <param name="checkController">The actual controller object that is being checked.</param> /// <param name="hand">The representation of a hand to check if the given controller matches.</param> /// <returns>Is true if the given controller matches the given hand.</returns> public static bool IsControllerOfHand(GameObject checkController, ControllerHand hand) { if (hand == ControllerHand.Left && VRTK_SDK_Bridge.IsControllerLeftHand(checkController)) { return true; } if (hand == ControllerHand.Right && VRTK_SDK_Bridge.IsControllerRightHand(checkController)) { return true; } return false; }