title: Draw line from Player to Mouse position (Unity)
body: <p>When i press LMB i am rotating my player towards the mouse position, what i also want to do is simulate shooting. So when clicking LMB i want to create a line from the player position to the mouse position. My big issue is that my player is moving and i cant seem to figure out how to get the start position of the ray.</p>
  
  <p>As of now the ray renders from vector3(0,0,0) to the mouse position, which is not what i want. I want it to render from the PLAYER position to the mouse position.</p>
  
  <p>Here is my code:</p>
  
  <pre><code> void Update () {
  
   transform.Translate (Vector3.down * Time.deltaTime * movementSpeed, Space.World);
  
   if (Input.GetButtonDown("Fire1")) {
  
       Vector3 mousePos = new Vector3 (Input.mousePosition.x, Input.mousePosition.y, 10);
       Vector3 lookPos = Camera.main.ScreenToWorldPoint (mousePos);
       lookPos = lookPos - transform.position;
       float angle = Mathf.Atan2 (lookPos.y, lookPos.x) * Mathf.Rad2Deg + 90;
       transform.rotation = Quaternion.AngleAxis (angle, Vector3.forward);
  
       if (Time.time &gt; nextFire) 
       {
           nextFire = Time.time + fireRate;
           StartCoroutine (shotEffect());
           laserLine.SetPosition (1,this.transform.position+lookPos);            
       }
   }
  </code></pre>
  
  <p>}</p>