I know Unity can do this because there is a unity game called Portalizer. I’ve tried everything, but I just can’t get this to work as well as Portalizer or Portal. I have a game idea inspired by both Portalizer and Valve’s Portal series. I found something online that could help me, but It confuses me. It’s from the people who make Portalizer here it is:
-
Rendering: i look into MirrorReflection shader and script that you can find in Wiki. I have add two mirrors on scene and my goal was to render Reflection for camera that look on other mirror. I have modified transformation matrix that know relations between 2 portals and voila, all works fine.
-
Object teleporting: i have add inner trigger zone to portal which activates when you add moving object here. It simply create clone of this object and add script to it, that control his position and rotation using similar transformation matrix (like in previous step)
-
I have add a few zones to portals that send info about colliders to global script that manage them (enable|disable collision with walls, other objects e.t.c.)
-
To make object culling visually when it is inside portal, i have used interesting shader that i found on forum written by Aras. I modified it and got cool result, now my portals are connected and can seamless teleport object.
-
FPS teleporting: This is the most tricky part. How to teleport camera? I thinking about it too much and here is what i get. To make Camera looks fluid, i played with “Depth only” option. When i am creating clone for FPS, i also create Eyes for it, with absolutely the same params as your MainCam with rotation and position multiply on transformation matrix. Then i “wear glasses” while going through portal. This is basically a plane with transparent shader placed in front of camera. Then i placing projector behind each portal that project “Depth only shader” on this glasses and mix 2 camera views automatically.
So can someone please help me, I’ll put all who help in the credits of my game.
More Info: I script in C# and I do have Unity Pro