I’m new to the Unreal Engine and for university i have to do a project.
My goal is to create non-euclidean rooms, such like in the game The Stanley Parable, where you can get trapped in a loop of corners even though the corridor you came from was straight.
So i think the idea behind this is to make the player teleport into identical-looking rooms, like in the example, you go around a corner and get moved to another corner and whenever you go the same direction you get teleported to the same location.
I’ve found posts about creating portals like in Portal, but important to this idea is to make the player not notice he is being teleportated.
So, there’s two things when making a portal: the visuals and the teleportation.
I know the visuals are created by making a texture and a camera applying its vision to the texture.
The teleportation is done by an “enter-the-box” event. So, when the player enters the trigger box, he is moved to another location.
What i am struggling with is:
- to make the camera have the same perspective, so that when you look at the texture, it really looks like the corridor is going on
and 2) since it’s not just a door you are entering to get to another location, i need the player to get moved regardless, where he enters the “portal”
I hope i have expressed myself clearly, please feel free to ask for further infos
Thanks in advance for your answers
As far as teleportation goes, you could record where the player “enters to portal” as a point vector with actor rotation and all the relevant data in relation to the centre of the trigger box. Then have simple offset ready (i.e. the new room is exactly (100, 200, -450) units away from the original room), then apply this, added to the offset of the physical player actor from where your offset was taken from (e.g. the centre of the trigger box as mentioned above). That should get your player moved without them noticing.
I’m not sure if i’m really getting the idea across properly… You be the judge
Then for the ‘portal texture’, just move the camera in the new corridor exactly as the player’s camera is moving to create an identical image (assuming the hallways are identical). So if your player moves left in the first corridor, the camera sending it’s view to the texture moves to the left of the new corridor. This would also let you sanity check your new player position because theoretically the cameras should line up perfectly after teleportation
EDIT: The problem is really just dealing with parallax distortion as the player moves. I’m sure a quick google search will turn up useful tips if you’re really struggling.
Hope this helps, and let me know how it goes!
Thanks for the quick answer!
I believe i get your ideas, they seem very helpful, now i just got to get into the program to know how to do it
Anyways i think i know how to evade the portal texture-problem, just by creating a room, that has the complete desired form (a kind of cirlcled room), and by teleporting the player into that room, when entering the portal
I will try out the vector thing
In a few days, i will let you know, abour my progress
Okay, i now got it almost perfectly.
Ive just aligned the rooms, so that they are 500 units away. When the player enters the trigger box, he just gets teleported by 500 units in the direction of the other room.
The problem i now got is, that the teleport function just doesnt work properly. It seems to teleport at his own will. Most of the times it works alright, but sometimes it adds a little bit to the 500 units, sometimes even about the doubled amount.
Does anyone have similar experience with this? I very much appreciate your help
EDIT: its not affected by velocity or position of entering the box