private void Awake() { if (GetComponent<VRTK_InteractTouch>() == null) { Debug.LogError("VRTK_InteractUse is required to be attached to a SteamVR Controller that has the VRTK_InteractTouch script attached to it"); return; } interactTouch = GetComponent<VRTK_InteractTouch>(); controllerActions = GetComponent<VRTK_ControllerActions>(); }
private void DoObjectGrab(object sender, InteractableObjectEventArgs e) { if (e.interactingObject == controllers.left) { holdControl = controllers.left.GetComponent<VRTK_ControllerEvents>(); stringControl = controllers.right.GetComponent<VRTK_ControllerEvents>(); holdActions = controllers.left.GetComponent<VRTK_ControllerActions>(); stringActions = controllers.right.GetComponent<VRTK_ControllerActions>(); } else { stringControl = controllers.left.GetComponent<VRTK_ControllerEvents>(); holdControl = controllers.right.GetComponent<VRTK_ControllerEvents>(); stringActions = controllers.left.GetComponent<VRTK_ControllerActions>(); holdActions = controllers.right.GetComponent<VRTK_ControllerActions>(); } StartCoroutine("GetBaseRotation"); }
private void Start() { if (GetComponent<VRTK_ControllerEvents>() == null) { Debug.LogError("VRTK_ControllerEvents_ListenerExample is required to be attached to a SteamVR Controller that has the VRTK_ControllerEvents script attached to it"); return; } events = GetComponent<VRTK_ControllerEvents>(); actions = GetComponent<VRTK_ControllerActions>(); tooltips = GetComponentInChildren<VRTK_ControllerTooltips>(); //Setup controller event listeners events.TriggerPressed += new ControllerInteractionEventHandler(DoTriggerPressed); events.TriggerReleased += new ControllerInteractionEventHandler(DoTriggerReleased); events.ApplicationMenuPressed += new ControllerInteractionEventHandler(DoApplicationMenuPressed); events.ApplicationMenuReleased += new ControllerInteractionEventHandler(DoApplicationMenuReleased); events.GripPressed += new ControllerInteractionEventHandler(DoGripPressed); events.GripReleased += new ControllerInteractionEventHandler(DoGripReleased); events.TouchpadPressed += new ControllerInteractionEventHandler(DoTouchpadPressed); events.TouchpadReleased += new ControllerInteractionEventHandler(DoTouchpadReleased); tooltips.ShowTips(false); }
public override void Grabbed(GameObject grabbingObject) { base.Grabbed(grabbingObject); controllerActions = grabbingObject.GetComponent<VRTK_ControllerActions>(); }
private void Awake() { controllerEvents = GetComponent<VRTK_ControllerEvents>(); controllerActions = GetComponent<VRTK_ControllerActions>(); Utilities.SetPlayerObject(gameObject, VRTK_PlayerObject.ObjectTypes.Controller); destroyColliderOnDisable = false; defaultColliderPrefab = Resources.Load("ControllerColliders/HTCVive"); }
private void Awake() { trackedController = GetComponent<SteamVR_TrackedObject>(); controllerActions = GetComponent<VRTK_ControllerActions>(); }
private void Awake() { controllerActions = transform.parent.GetComponent<VRTK_ControllerActions>(); triggerInitialised = false; gripInitialised = false; touchpadInitialised = false; appMenuInitialised = false; availableButtons = new TooltipButtons[] { TooltipButtons.TriggerTooltip, TooltipButtons.GripTooltip, TooltipButtons.TouchpadTooltip, TooltipButtons.AppMenuTooltip }; buttonTooltips = new GameObject[availableButtons.Length]; tooltipStates = new bool[availableButtons.Length]; for (int i = 0; i < availableButtons.Length; i++) { buttonTooltips[i] = transform.FindChild(availableButtons[i].ToString()).gameObject; } InitialiseTips(); }