// Use this for initialization void Awake() { materialCB = DefaultTransitionMatCB; MeshRenderer[] rnds = GetComponentsInChildren <MeshRenderer>(); foreach (MeshRenderer rnd in rnds) { // is mesh renderer if (rnd.sharedMaterial.shader.name.Equals("ViveSR/PortalMeshShader")) { renderers.Add(rnd); } } ParticleSystemRenderer[] particleRnds = GetComponentsInChildren <ParticleSystemRenderer>(); foreach (ParticleSystemRenderer particle in particleRnds) { effectRnds.Add(particle); } }
public void OnTriggerEnter(Collider other) { ViveSR_Portal otherPortal = other.transform.root.GetComponent <ViveSR_Portal>(); if (otherPortal) { hitPortal = otherPortal; hitPortalRnd = hitPortal.GetComponentInChildren <MeshRenderer>(); CheckWorldSide(hitPortal); // check which world is now isTransitioning = true; selfCld.isTrigger = true; materialCB = otherPortal.TransitionMaterialUpdateCB; // set the material behaviours when transitioning if (renderers == null) { renderers = gameObject.GetComponentsInChildren <Renderer>(true); } SetClippingPlaneEnable(renderers, true, currentWorld); CheckTransitioningBehavious(); } }