How to implement a system for "Road-Construction"?


im struggling with the concept for a “Roadsystem” and hope someone could give me a hint.

At the moment i got a script wich takes a startpoint(A) (when i leftclick) and then let me choose the endpoint(B) (leftclick again). When the endpoint is set i calculate the distance between those two and divide it with my gridsize (for gridsnapping) to get the amount of “Roadsegments” i need to reach from A to B.
Then i instantiate the amount of roads i need and at this point i stuck :frowning:

I couldnt find a way to change the transform of each road so they will form a straight line from A to B after i instantiate them.
So i primarily looking for a way to change the transform toward a certain point.

I hope someone could help me :slight_smile:

You could orient the segments by using LookAt but depending on how you utilize height, you might need to change the input vectors y to your current segments y. Remember its important how you layout your tiles in your modeling software, eg. all segments have the same center and same orientation.