Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Discussion Freeform Road Builder 2D ideas

Discussion in '2D' started by gzckrg1, Feb 6, 2023.

  1. gzckrg1


    Jun 24, 2020
    Hi all,

    I'm experimenting on how to make a freeform road builder in a 2D project. It should work in runtime, so it can be used as a road building tool for a city building game. It should be as freeform as possible, with almost no grid or angle restrictions (or very few where it doesn't make sense to make a 10 degree sharp cornered road for example). And user should be able to change the road width, number of lanes, within a logical restriction, without a prior sprite for each option, apart from a generic road asphalt sprite and road lane sprites. In terms of finding the positions for where lanes are, compared to the road itself or how to lay the road itself, I can pretty much figure out how to do this. But when it comes to the visuals to show the correct laying off of the lanes or intersection for the roads, or the corners, I'm not sure how to do that.

    One idea I have is using unity's Sprite Shape Controller component and use it in the runtime. However, when I started with that, I encountered some problems. Main problems I have are:
    - Sprite Shape Controller is still not very well documented and is still a bit like a black box.
    - The corner visuals are not good for sharper corners.
    - It will be very hard to calculate and add a 'code generated' sprite for intersections, again mostly because sprite shape controller is like a black box.

    Another idea is using maybe Shader Graph tool. I'm not very proficient with this tool. But if someone thinks it may be a good idea and give me some 'where to start' recommendation, I can try it.

    Or any other idea you can think of is also welcomed.