How can I draw roads onto a terrain similar to Cities: Skylines?

Hello everyone!

I’ve been working on a city building game for a few weeks now, and have gotten down some basic systems such as placing buildings etc but I am having trouble trying to figure out how to draw a road onto a terrain.

I’ve been doing some research but haven’t been able to find anything that is what I want or that can help me. What im looking for is being able to draw a road onto the terrain and set the length by dragging from point A to B.

Would anybody be able to help me with this or point me in the way of a tutorial that can? Thank you very much :slight_smile:

https://www.youtube.com/watch?v=saAQNRSYU9k

You just need to project down onto the terrain. And of course work on it a lot to have one which looks nice in every (or at least most) case(s).

1 Like

If you look closely in Cities: Skylines, then you notice that when placing a road, it actually connects two points in a grid with the road mesh.

There is a plentitude to do this in Unity, one solution would be using splines. A spline is a bunch of points that are connected with each other via polynomials, even if there are only two points which are connected with a linear line. Along these splines, you can create meshes, in your case roads. There are some great assets around spline mesh generation at runtime, both free and paid ones. I recommend you to check out the Asset Store.