Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

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

Discussion in 'Scripting' started by Monigue, Feb 15, 2021.

  1. Monigue

    Monigue

    Joined:
    Oct 3, 2019
    Posts:
    2
    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?
     
  2. sstrong

    sstrong

    Joined:
    Oct 16, 2013
    Posts:
    2,183
    Without a code snippet, it will be difficult for people to provide suggestions or help.
     
    exiguous likes this.