Question by 
               kenjisma123 · May 23, 2018 at 04:57 AM · 
                spritemousepositionflip  
              
 
              How can I rotate a Sprite with the mouse? Like terraria or Starbound
I I tried doing this in code but it did not work
     float angle;
     Vector3 posi = cam.WorldToScreenPoint(transform.position);
     posi.z = 0;
     Vector3 dire = Input.mousePosition;
     dire.x = dire.x - posi.x;
     dire.y = dire.y - posi.y;
     angle = Mathf.Atan2(dire.y, dire.x) * Mathf.Rad2Deg;
    if (angle > 90 || angle < 360)  
     {
         //sprite.flipX = false;
         Flip();
     }
     if (angle < 90 || angle > 360)
     {
         //sprite.flipX = true;
         Flip();
     }
    void Flip()
 {
     sprite.flipX = !sprite.flipX;
 
              
               Comment
              
 
               
              Your answer
 
             Follow this Question
Related Questions
Network flip 0 Answers
Sprite 2D Flip issue 1 Answer
Flip sprite sync Network problem 0 Answers
Flipping a sprite with an attached gameobject 0 Answers
How do i get my character to move 3 Answers