Rotation smoothing
So as noone can answer my other question, I will try to ask another and specify my problem more. I managed to get the player to always look in the mouse direction in my topdown game:
 void Update() {
     //Follow mouse
     Vector3 diff = Camera.main.ScreenToWorldPoint(Input.mousePosition) - transform.position;
     diff.Normalize();
     float rot_z = Mathf.Atan2(diff.y, diff.x) * Mathf.Rad2Deg;
     transform.rotation = Quaternion.Euler(0f, 0f, rot_z - 90);
     }
Because I wanted some smoothing, i did this:
 void Update() {
     //Follow mouse
     Vector3 diff = Camera.main.ScreenToWorldPoint(Input.mousePosition) - transform.position;
     diff.Normalize();
     float rot_z = Mathf.Atan2(diff.y, diff.x) * Mathf.Rad2Deg;
     float z = Mathf.SmoothDampAngle(transform.eulerAngles.z,rot_z - 90, ref zVelocity, smooth);
     transform.rotation = Quaternion.Euler(0f, 0f, z);
     }
Is there any better way to do the smoothing?
               Comment
              
 
               
              Your answer
 
 
             Follow this Question
Related Questions
How Can I Convert Vector3 From Local To Global(World)? 0 Answers
Mouse Look Script Not Working 1 Answer
Rotate towards mouse pointer 1 Answer
TopDown Look at mouse 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                