How to generate road like in Audiosurf like game?

Hello,

I am trying to learn how it´s possible to generate road from some input data. I ma using unity for a while but I have no idea how it´s possible to generate for example a road that floats in the air (i mean, that it´s not a general terrain) so i will get a bumpy twisted road. For example the Riff Racer game or audiosurf did the same (and probably more other games), they get input data from music, they generate a road which is ride-able.

I know that with transform you can change the size, position and rotation of and game object. but I don´t think that this is the solution to create lot of cubes, snap them together to get a road. So there is probably other technique to do this. So generally i have 2 questions:

  1. How to generate road on some input data
  2. Is the “player” position fixed and the road/world moves or the player moves on the road (if player moves then when road is twisted down head, so normally in unity player should fall of the road)

I think the solution might be the Bezier Spline curve. If it is please let me know, if no please give me some good resources. The solution should be mobile friendly.

Thank you for any resources

Thank you, today i got time to experiment with it.

It´s insanely hard or I just really do not understand it. First I tough it will be like creating some Vector3 way-points, set some width, height(thickness), some triangle density, rotation for way-points to twist and band the path/track/road/whatever… call some generate method and it will generate a mesh for path where I add the generated mesh to mesh filter and mesh collider of and empty game object, then set some material.

You can find links to GitHub code on the YouTube page, but if you’re more artist than coder then I would suggest looking into spline based mesh generation tools on the asset store to do this for you or to just stick with your favorite 3D modelling software and import tracks as static meshes. The latter of course would be unsuitable for procedural generation.