- Home /
Infinity Hallway
Hi everyone,I'd like to know if its possible to make an "infinite" hallway. Meaning, Make the player think hes going through a really long hallway but really the player is just being teleported back to the middle of it without the player noticing. Is this possible? Please and Thank You.
Answer by aldonaletto · May 21, 2012 at 01:31 AM
No problem: use a trigger (more versatile) or just compare coordinates (needs an axis aligned hallway), then subtract the appropriate fixed distance from the player position:
// hallway aligned to world Z axis var distance: float = 50; // the distance is the exact size of the hallway module
function Update(){ if (transform.position.z > initPos.z + distance){ transform.position.z -= distance; } if (transform.position.z < initPos.z){ transform.position.z += distance; } } You must have a hallway module and repeat it enough times ahead and behind the center position, and distance must be set to the module length.
I think long distance fog obscuring far objects would help with this. Also, if there are other objects/agents in the tunnel, make sure they teleport with the player. To increase the illusion of the tunnel being infinite, you could add procedurally generated detail objects (chairs, doors, furniture) that are created randomly with each new corridor segment!
Your answer
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Assigning varaibles to prefabs 1 Answer
2D Player Spawn Issue 0 Answers
Teleport 2D Player to another room 2 Answers
Change skybox at runtime? 2 Answers