private void OnTriggerExit(Collider other) { if (!traveller) { traveller = other.GetComponent <PortalTraveller>(); } else if (traveller.Sender.gameObject != portal.gameObject) { traveller.Sender = null; traveller = null; portal.Screen.enabled = true; } }
private void OnTriggerEnter(Collider other) { traveller = other.GetComponent <PortalTraveller>(); if (traveller && !traveller.Sender) { traveller.Sender = portal; //HandleClipping(linkedPortal.Screen); linkedPortal.Screen.enabled = false; Matrix4x4 m = GetPositionAndRotationMatrix(traveller.transform, portal.transform, linkedPortal.transform); Teleport(portal.transform, linkedPortal.transform, m, traveller.transform.GetComponent <Movement>(), traveller.transform.GetComponentInChildren <MouseLook>()); } }