title: Unity: Rotate towards mouse in 3D topdown view
body: <p>So I am trying to create a kind of turrent like a tank. The upper section needs to look at my mouse. I have tried</p>
  
  <pre><code>GetComponent().ScreenToWorldPoint(Argument);
  </code></pre>
  
  <p>many times togheter with</p>
  
  <p>Input.mousePosistion();</p>
  
  <p>But I couldn't figure this out really. I am programing this in C# if any one could help or provide a simple script that works in a 3D setting that would be great!</p>
  
  <p>My code so far:</p>
  
  <pre><code>using UnityEngine;
  using System.Collections;
  
  public class Laser : MonoBehaviour {
      public float Speed;
      public AudioClip LaserSFX;
      private Transform Player;
      public Vector3 mousePos;
      public Camera Cam;
  
      // Use this for initialization
      void Start () {
          GameObject player = GameObject.FindWithTag("Player");
          Player = player.transform;
          if(!GetComponent&lt;AudioSource&gt;().isPlaying)
          GetComponent&lt;AudioSource&gt; ().PlayOneShot (LaserSFX);
      }
  
      // Update is called once per frame
      void Update () {
  
          //Code to look at mouse or rotate
          //Code to move towards it
  
          float dist = Vector3.Distance(Player.position, transform.position);
          if (dist &gt;= 500) 
          {
              Destroy(gameObject);
          }
      }
  
  }
  </code></pre>
  
  <p>With kind regards,</p>
  
  <p>Misterk99</p>