title: Unity 2D - How can I use a joystick to aim in a TopDown shooter game?
body: <p>I have created a game in Unity 2D which is a 2D TopDown shooter game. I want to convert the game from PC to Android, so I need to create a joystick for aiming. Right now, I can aim where I want using my mouse with this code:</p>
  <pre><code>void FixedUpdate()
  {
  
      rb.MovePosition(rb.position + movement * moveSpeed * Time.fixedDeltaTime);
  
      Vector2 lookDir = mousePos - rb.position;
      float angle = Mathf.Atan2(lookDir.y, lookDir.x) * Mathf.Rad2Deg;
      rb.rotation = angle;
  }
  </code></pre>
  <p>How exactly can I create an on-screen joystick which reads the position of where I am dragging it, and use that position to point my character to the corresponding position?</p>
  <p>Thanks!</p>