- Home /
How to implement a system for "Road-Construction"?
Hi,
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 :(
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 :)
Answer by Nischo · Jul 11, 2015 at 12:57 PM
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.
well that helped quite alot :D
i got it working. I tried to apply an offset to each segment but the bad orientation let me struggle.
Thanks alot for that hint ^^