Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

How Do I Create An Unending Road In A Map?

Discussion in 'General Discussion' started by chicice, Apr 14, 2019.

  1. chicice

    chicice

    Joined:
    Apr 14, 2019
    Posts:
    2
    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!
     
    Last edited: Apr 14, 2019
  2. Cucci_A

    Cucci_A

    Joined:
    Jan 23, 2018
    Posts:
    451
    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.
     
  3. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,368
    To extend upon @Cucci_A 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.
     
    Joe-Censored likes this.
  4. chicice

    chicice

    Joined:
    Apr 14, 2019
    Posts:
    2
  5. SparrowsNest

    SparrowsNest

    Joined:
    Apr 6, 2017
    Posts:
    1,405
    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.
     
    Joe-Censored and GameDevCouple_I like this.
  6. GameDevCouple_I

    GameDevCouple_I

    Joined:
    Oct 5, 2013
    Posts:
    1,415
    OP, this shows how to do this technique but side scrolling, same can be applied for tunnel:

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

    Enjoy!