Esempio n. 1
0
        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();
            }
        }
Esempio n. 2
0
        public void OnTriggerExit(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   = false;
                selfCld.isTrigger = originIsTrigger;

                if (isPlayer)
                {
                    portalMgr.viewerInWorld = currentWorld;
                    portalMgr.UpdateViewerWorld();
                    gameObject.layer = LayerMask.NameToLayer((currentWorld == WorldMode.RealWorld)? "Default" : "VirtualWorldLayer");
                }
                else
                {
                    if (isController)
                    {
                        portalMgr.controllerInWorld = currentWorld;
                    }
                    if (renderers == null)
                    {
                        renderers = gameObject.GetComponentsInChildren <Renderer>(true);
                    }
                    SwitchMaterials(renderers, currentWorld);
                    SetClippingPlaneEnable(renderers, false, currentWorld);
                }

                CheckTransitioningBehavious();
            }
        }