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.
1 Answer
1No 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!
– syclamothThank you so much for this!
– ZestyTaco