- Home /
Rendering when 'moving a character controller through a "portal"'
I'm writing some scripts to support fixed-location portals in Unity Pro. The portals are being rendered using RenderTextures and cameras with appropriately-set off-axis frustums. The view is first-person. The challenge is making the transition from "standing on one side of the "portal" looking at the render object to "teleported to new position." The smoothest transition I've been able to create involves creating a trigger with the same radius as the camera's near clip plane distance, and triggering the teleport behavior when the triggers intersect. The problem here is that the player's physics collider is significantly larger than the near clip plane. If the portal plane is up against a wall, the player controller can't get close enough for the trigger to intersect the portal trigger. Any thoughts on other potential solutions? I'm more concerned with the first-person view
Any thoughts on how to do this better/differently to achieve better results?
The question is less about how to actually move the character and more how to set up the transition to be as seamless as possible. Right now, you walk up to a portal, and the rtt surface is at (eye camera's near-clip plane) distance. $$anonymous$$y teleport script moves the character (and the camera) to somewhere on the surface of the "exit" portal. This means your view jumps at least the near clip distance, which is noticeable. I'd like to avoid that jump.
ok, that makes more sense now :)
From sitting there trying to come up with a solution, I have come to the conclusion that a little jump is unavoidable, but here are some tips for $$anonymous$$imising the effect:
Have the near clip plane as low as possible (pretty obvious XD)
Add a little velocity to the object (or make sure it has a $$anonymous$$imum) before teleporting. That will make the "jump" seem less obvious
$$anonymous$$aybe add a "tiny" little bit of image blur for a couple frames "during" teleportation
AFAI$$anonymous$$ there is no way to avoid the issue, but It might be good to get some input from others ;)
Answer by RyanSpicer · Aug 13, 2013 at 06:36 PM
I've been thinking about this further. One thing I'm considering is making the "portals" 5-walled rooms with RTT on all 5 faces, rather than a single face in a door frame. The character would be teleported while standing in the middle of the "entrance" portal -- in the 'exit' portal, the wall ahead would be open, the surfaces behind/beside/above would be RTT. This ought to let me get closer to seamless. Since I'm not allowing portals to be moved, the level geometry can be designed to accommodate this.
I recall from long ago, using Unreal, they had a 'portal zone' or something, my guess is it was a way to do this type of thing. You would have to make a little room behind your portal to go into, and having done that, would snap you to the destination. I think you're on to something with this.
Answer by DaveA · Aug 13, 2013 at 06:44 PM
Could you not 'arrive' at the destination offset back (that is -transform.forward) from where you currently end up?
That could cause problems, think of what would happen if the player only just goes through the portal and then turns around. He would see through the wall/teleport