How do I make a gameobject rotate towards the mouse's direction?

I’m trying to make a system similar to Cities: Skylines’ roads. I’ve so far got the length of the road right, but I’ve been stuck at trying to get the rotation correct. I’m trying to rotate it around the y-axis and I’ve tried FromToRotation and LookRotation, but those resulted in gimbal lock when going close to the 360-degree mark, I’ve thought of instead manipulating each vertice, but I am also stuck as to how to implement that. I’m just stuck as to how I’m going to approach this now, any solutions?

Without a code snippet, it will be difficult for people to provide suggestions or help.

1 Like