protected virtual void RestoreDefaults() { if (objectToMonitor != null && objectToMonitor.IsTouched()) { foreach (GameObject touchingObject in new HashSet <GameObject>(touchingObjects)) { ToggleState(touchingObject, gameObjectActiveByDefault, rendererVisibleByDefault, VRTK_InteractableObject.InteractionType.None); } foreach (GameObject nearTouchingObject in new HashSet <GameObject>(nearTouchingObjects)) { ToggleState(nearTouchingObject, gameObjectActiveByDefault, rendererVisibleByDefault, VRTK_InteractableObject.InteractionType.None); } } }
protected virtual void UseUnHighlightObject(object sender, InteractableObjectEventArgs e) { VRTK_InteractableObject interactableObject = sender as VRTK_InteractableObject; if (interactableObject.IsGrabbed()) { Highlight(grabHighlight); OnInteractObjectHighlighterHighlighted(SetEventArgs(VRTK_InteractableObject.InteractionType.Grab, e.interactingObject)); } else if (interactableObject.IsTouched()) { Highlight(touchHighlight); OnInteractObjectHighlighterHighlighted(SetEventArgs(VRTK_InteractableObject.InteractionType.Touch, e.interactingObject)); } else if (interactableObject.IsNearTouched()) { Highlight(nearTouchHighlight); OnInteractObjectHighlighterHighlighted(SetEventArgs(VRTK_InteractableObject.InteractionType.NearTouch, e.interactingObject)); } else { Unhighlight(); OnInteractObjectHighlighterUnhighlighted(SetEventArgs(VRTK_InteractableObject.InteractionType.Unuse, e.interactingObject)); } }
protected virtual void NearTouchUnHighlightObject(object sender, InteractableObjectEventArgs e) { VRTK_InteractableObject interactableObject = sender as VRTK_InteractableObject; if (!interactableObject.IsTouched()) { Unhighlight(); OnInteractObjectHighlighterUnhighlighted(SetEventArgs(VRTK_InteractableObject.InteractionType.NearUntouch, e.interactingObject)); } }
void Update() { if (dataPoint.IsTouched()) { if (Input.GetKeyDown(KeyCode.Space)) { text.text = "Data point collision:\n" + "Azimuth: " + aAngle + "\nElevation: " + eAngle + "\nRadius: 0.8"; } } }
protected virtual void StopTouching(GameObject untouched) { OnControllerStartUntouchInteractableObject(SetControllerInteractEvent(untouched)); if (IsObjectInteractable(untouched)) { GameObject touchingObject = gameObject; VRTK_InteractableObject untouchedObjectScript = untouched.GetComponent <VRTK_InteractableObject>(); untouchedObjectScript.StopTouching(touchingObject); if (!untouchedObjectScript.IsTouched()) { untouchedObjectScript.ToggleHighlight(false); } } ToggleControllerVisibility(true); OnControllerUntouchInteractableObject(SetControllerInteractEvent(untouched)); CleanupEndTouch(); }
// Token: 0x060015FB RID: 5627 RVA: 0x00077DE0 File Offset: 0x00075FE0 protected virtual void StopTouching(GameObject untouched) { this.OnControllerStartUntouchInteractableObject(this.SetControllerInteractEvent(untouched)); if (this.IsObjectInteractable(untouched)) { VRTK_InteractableObject vrtk_InteractableObject = (untouched != null) ? untouched.GetComponent <VRTK_InteractableObject>() : null; if (vrtk_InteractableObject != null) { vrtk_InteractableObject.StopTouching(this); if (!vrtk_InteractableObject.IsTouched()) { vrtk_InteractableObject.ToggleHighlight(false); } } } this.ToggleControllerVisibility(true); this.OnControllerUntouchInteractableObject(this.SetControllerInteractEvent(untouched)); this.CleanupEndTouch(); }
protected virtual void StopTouching(GameObject untouched) { OnControllerStartUntouchInteractableObject(SetControllerInteractEvent(untouched)); if (IsObjectInteractable(untouched)) { VRTK_InteractableObject untouchedObjectScript = (untouched != null ? untouched.GetComponent <VRTK_InteractableObject>() : null); if (untouchedObjectScript != null) { untouchedObjectScript.StopTouching(this); if (!untouchedObjectScript.IsTouched()) { untouchedObjectScript.ToggleHighlight(false); //untouchedObjectScript.ToggleShowInfo(false); } } } ToggleControllerVisibility(true); OnControllerUntouchInteractableObject(SetControllerInteractEvent(untouched)); CleanupEndTouch(); }
/// <summary> /// The ToggleControllerOnGrab method determines whether the controller should be shown or hidden when grabbing an interactable object. /// </summary> /// <param name="showController">If true then the controller will attempt to be made visible when no longer grabbing, if false then the controller will be hidden on grab.</param> /// <param name="grabbingObject">The grabbing object to apply the visibility state to.</param> /// <param name="ignoredObject">The object that is currently being interacted with by the grabbing object which is passed through to the visibility to prevent the object from being hidden as well.</param> public virtual void ToggleControllerOnGrab(bool showController, GameObject grabbingObject, GameObject ignoredObject) { if (hideControllerOnGrab) { VRTK_InteractableObject objScript = (ignoredObject != null ? ignoredObject.GetComponentInParent <VRTK_InteractableObject>() : null); //if attempting to show the controller but it's touched and the touch should hide the controller if (showController && !touchControllerShow && objScript && objScript.IsTouched()) { return; } grabControllerShow = showController; ToggleController(showController, grabbingObject, ignoredObject, hideDelayOnGrab); if (showController) { OnVisibleOnGrab(SetEventPayload(grabbingObject, ignoredObject)); } else { OnHiddenOnGrab(SetEventPayload(grabbingObject, ignoredObject)); } } }
// Token: 0x0600156C RID: 5484 RVA: 0x00075F7C File Offset: 0x0007417C public virtual void ToggleControllerOnUse(bool showController, GameObject usingObject, GameObject ignoredObject) { if (this.hideControllerOnUse) { VRTK_InteractableObject vrtk_InteractableObject = (ignoredObject != null) ? ignoredObject.GetComponentInParent <VRTK_InteractableObject>() : null; if (showController && ((!this.grabControllerShow && vrtk_InteractableObject && vrtk_InteractableObject.IsGrabbed(null)) || (!this.touchControllerShow && vrtk_InteractableObject && vrtk_InteractableObject.IsTouched()))) { return; } this.ToggleController(showController, usingObject, ignoredObject, this.hideDelayOnUse); if (showController) { this.OnVisibleOnUse(this.SetEventPayload(usingObject, ignoredObject)); return; } this.OnHiddenOnUse(this.SetEventPayload(usingObject, ignoredObject)); } }