Search Unity

Please Can Someone Help?

Discussion in 'General Discussion' started by johnny2014, Mar 19, 2018.

  1. johnny2014

    johnny2014

    Joined:
    Jun 11, 2014
    Posts:
    9
    Hi everyone,
    I have been trying for days to re create this road movement from this video of Color Roads and I just can't work it out.



    The road moves higher and lower and also curves. I can make it in a straight line but thats boring, please if someone could help me out I would be very grateful.

    I have tried to find tutorials but nothing comes up like this that I can find.

    Thank you
     
  2. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,884
    Looks like spline / nurb modeling. Model the entire track with Splines / Nurbs, or do each piece separately with splines / nurbs.

    But then again, it could all just be a vertex shader that gives them twisty curves up and downwards.

    So you could technically have flat roads and do your corners, etc. But use a Curved World vertex shader to give the bending effects.
     
    johnny2014 likes this.
  3. johnny2014

    johnny2014

    Joined:
    Jun 11, 2014
    Posts:
    9
    Thanks mate, I'll look into the curved world vertex shader and see how I go. Cheers
     
    N1warhead likes this.
  4. zombiegorilla

    zombiegorilla

    Moderator

    Joined:
    May 8, 2012
    Posts:
    9,051
    johnny2014 and Ryiah like this.
  5. BoogieD

    BoogieD

    Joined:
    Jun 8, 2016
    Posts:
    236
    Here is some bezier curve code that is easy to understand. From that you could dynamically build a mesh or lay down many short mesh sections to follow the curve. You will also need to walk the curve in equal steps which requires some more code and when you overlay meshes slightly on angle to create the illusion of a broad curve they will need to be overlaid at slightly different heights to avoid surface flicker.
    I noticed the road in the example rolls to the side around bends therefore that also needs to be considered.

    http://www.habrador.com/tutorials/interpolation/2-bezier-curve/
     
    johnny2014 likes this.
  6. johnny2014

    johnny2014

    Joined:
    Jun 11, 2014
    Posts:
    9
    Thank you all for your help, I really appreciate you taking the time. I'll do my best to follow these instructions and see if I can come up with a working project.
    Thanks again