I’m trying to make a grid-based road system, and I was wondering how I could implement a check to decide what orientation and type roads should be.
As you can see in this diagram, I want to be able to determine the shape and rotation of the grid piece at (1, 2) by checking how many roads it neighbors and what direction they are touching from. My possible road parts are shown on the right.
It’s relatively trivial to count the amount of neighboring road pieces and decide a part based off of that, but I’m not entirely sure how I could determine the rotation of the piece to align with surrounding pieces. Any help would be appreciated!