Determining road rotation in a 2D grid

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!

5 Likes

maybe try to change the orientation of the cam by doing game.workspace.currentcam.cframe.orientation

You just need to determine rotation or something else too?

Solved by scrapping this awful system and just copying a generic road part for each neighboring road, and rotating to align.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.