public override void OnTriggerExit(Collider c) { GameObj obj = c.GetComponent <GameObj>(); if (obj) { if (obj == highlightObj) { highlightObj = null; } obj.DeSelect(); } }
public override void OnTriggerStay(Collider c) { GameObj obj = c.GetComponent <GameObj>(); if (!handController.activeObj && obj) //if we're not already holding an object, continue checking closest object to select { HighlightClosest(obj); if (highlightObj != null && obj != highlightObj) { obj.DeSelect(); return; } // Deselect and exit function if this is not the highlighted object if (IsGrabbing() && (highlightObj.owner == null || highlightObj.canUseBothHands)) { highlightObj.DeSelect(); handController.ChangeState(highlightObj.Activate(handController)); } } }