Exemple #1
0
    void SwapPortalable(PortalSurface oldPortalable, PortalSurface newPortalable, int mask)
    {
        if (oldPortalable.collider != null)
        {
            oldPortalable.collider.enabled = true;
            oldPortalable.gameObject.layer = oldPortalable.layerMask;
        }

        newPortalable.collider.enabled = false;
        newPortalable.gameObject.layer = mask;
    }
Exemple #2
0
 public void PlaceB(RaycastHit ray_hit)
 {
     // place portalA
     if (ray_hit.collider.CompareTag("Portalable"))
     {
         //Fix colliders
         PortalSurface new_portalable = new PortalSurface(ray_hit.transform.gameObject, ray_hit.collider, ray_hit.transform.gameObject.layer);
         SwapPortalable(_portalableB, new_portalable, camBIgnore);
         _portalableB = new_portalable;
         // Get portals new position and roation
         // Temp fix
         Vector3    off      = ray_hit.transform.up + ray_hit.transform.right / 2;
         Vector3    position = ray_hit.transform.position + off + (ray_hit.transform.forward * offset);
         Quaternion rotation = Quaternion.LookRotation(ray_hit.transform.forward, Vector3.up);
         // Apply position and rotation
         Place(portalB, position, rotation);
     }
 }