How Do I Create An Unending Road In A Map?

Hi all

I’m trying to experiment with something here, im curious to try making an unending tunnel in 3D where if you go front or back, you’ll never reach the end of the tunnel. Only able to see the exit. But i’d like a certain space to walk around either, not just front and back

Is this possible? You walk towards the exit (front or back) forever, the tunnel keeps on going and going and the exit(s) stays static at one position. Procedural i suppose?

I’m still new and learning, so any help would be greatly appreciated. This idea is for me to play around and get more familiar with unity and C# in general

Thanks!

I suppose one way of doing this would be to just have the tunnel object follow your player object.
Wherever the player moves, the tunnel moves with them.

This could be set up the exact same way you set up a camera to follow a player.

To extend upon @Vryken answer - you can also setup a script that can offset your tunnels textures so it appears to be moving when in reality it’s just sliding the textures to a direction of your choice to give the illusion of movement.

1 Like

Thanks @Vryken and @N1warhead_1 for both of your ideas!

Or you can put the player on a tread mill and when he moves forward keep him in place(while animating walking) and move the tunnel back, generating more tunnel when it comes into view and destroying old segments when the player passes them.

better to re-use the segments if you do it this way.
one thing this does avoid is ending up with a player position way off from (0,0,0) causing all sorts of graphical glitches.

2 Likes

OP, this shows how to do this technique but side scrolling, same can be applied for tunnel:

https://catlikecoding.com/unity/tutorials/runner/

Enjoy!