Hello, I want to make a looping corridor… As the character walk straight he continuously opens the same door and walks in the same corridor, but when he turns back (there will be a door in the back as well) he would escape the looping corridor.
I hope that’s not confusing, thank you.
It will be confusing for player.
easiest way is to repeat corridor 3 times, one ahead of player and one time behind. 3 Identical corridor section.
When player steps out from middle section, you teleport player pawn to location on opposite end of middle corridor.
This will be easy to do for simple straght corridor, but more you add to game harder it will be to create this effect.
Another way of making it all would be with Portals. Google for unreal + portal, it is not easy to create.
It wouldn’t work with the 3 corridors, since it has to align with the rest of the level… Also, no idea how will it work with portals. Any other suggestions?
So you purely want the player have two directions, one endlessly repeating door and one exit door, right?
In that case, teleportation is exactly what you want:
Double the corridor. When they open the infinite door, they look into the duplicate of the corridor. When they move through the doorstep, they get teleported back to the beginning of the original corridor and the door is instantly reset into a closed position.
Will the player ever be able to see the area from the outside? If yes, you can do a single dummy corridor on the normal map (basically, what the corridor would be like if it didn’t have mind**** powers) and place the actual endless corridor in some hidden corner of the map.
Player opens door to the real corridor, moves past doorstep, gets teleported into endless corridor. Player uses exit door on the infinite corridor, gets teleported back to the doorstep of the real corridor.
Great idea, but how can I make it seamless? The door has to be the EXACT size of the character, otherwise the player can be touching the left side of the doorframe, and will get teleported in the middle instead… This will be noticeable. I am digging the suggestion though!
PS also, what if the player is looking backwards as they pass through? You’ll see the door close in an instance.
This is how I just tested this.
I built a trigger volume and then made a second one with exactly the same size. I didn’t do any in-depth testing, but it seems like it is working.
First of all, I took the current actor’s rotation and just re-used it, because both corridors have the same rotation. If that varied, there’d be some math to be done.
Second of all, I simply calculated how the actor relates to the trigger volume, then gave it that same relation to the other trigger volume. Which is done by subtracting and adding.
(To be honest, I just randomly did the first thing that came to mind, so there might be issues with my calculation)
As a player, you do not notice the transition. Just keep in mind that you are teleporting to the exact location in relation to your trigger box, as you had with the last trigger box. This means that offsetting any of the triggerboxes will offset the teleportation and possibly mess it up.