/// <summary> A (feedback) collider exits the detector. </summary> /// <param name="other"></param> protected virtual void OnTriggerExit(Collider other) { // Debug.Log("Letgo!"); if (this.modelToCheck != null) //we have access specific GameObjects { int index = ColliderIndex(other.gameObject); //Debug.Log("Releasing Index " + index); this.SetTouch(index, false); if (index > -1 && this.finger[index] <= 0) //check if we removed all fingers. { this.MarkTouching(this.modelToCheck.senseGlove, false); } } else //no access, so we need to check for scripts. { SenseGlove_Feedback script = other.GetComponent <SenseGlove_Feedback>(); if (script != null) { int index = script.GetIndex(); this.SetTouch(index, false); if (index > -1 && this.finger[index] <= 0) //check if we removed all fingers. { this.MarkTouching(script.handModel.senseGlove, false); } } } }
/// <summary> A (feedback) collider exits the detector. </summary> /// <param name="other"></param> private void OnTriggerExit(Collider other) { // Debug.Log("Letgo!"); if (this.modelToCheck != null) //we have access specific GameObjects { int index = ColliderIndex(other.gameObject); //Debug.Log("Releasing Index " + index); this.SetTouch(index, false); } else //no acces, so we need to check for scripts. { SenseGlove_Feedback script = other.GetComponent <SenseGlove_Feedback>(); if (script != null) { this.SetTouch(script.GetIndex(), false); } } }
/// <summary> A new (feedback) collider enters the detector. </summary> /// <param name="other"></param> protected virtual void OnTriggerEnter(Collider other) { // Debug.Log("Touche!"); if (this.modelToCheck != null) //we have access specific GameObjects { int index = ColliderIndex(other.gameObject); //Debug.Log("Touching Index " + index); this.SetTouch(index, true); this.MarkTouching(this.modelToCheck.senseGlove, true); } else //no acces, so we need to check for scripts. { SenseGlove_Feedback script = other.GetComponent <SenseGlove_Feedback>(); if (script != null && script.handModel != null) { this.SetTouch(script.GetIndex(), true); this.MarkTouching(script.handModel.senseGlove, true); } } }
private bool ValidScript(SenseGlove_Feedback touch) { return(this.detectionMethod == DetectionType.AnyFinger || (this.detectionMethod == DetectionType.SpecificFingers && this.ValidScript(touch.GetIndex()))); }