- Home /
 
 
               Question by 
               $$anonymous$$ · Aug 29, 2014 at 07:47 AM · 
                c#rotationspritequaterniontowards  
              
 
              2D Rotation of a Sprite - Quaternion.FromToRotation Smooth
Hello! Im trying to rotate a 2D sprite towards another one. I`ve tried
 transfrom.LookAt(target.transform.position)
 
 transfrom.LookAt(target.transform.position,Vector.forward)
 
 transfrom.LookAt(target.transform.position,Vector.up)
 
 Quaternion.Slerp(transform.rotation,target.transform.rotation,Time.deltaTime * Speed);
 
 Quaternion.Lerp(transform.rotation,target.transform.rotation,Time.deltaTime * Speed);
 
               It rotates x or y axis.I want a sprite rotate only z axis and face towards another sprite. Only line that work perfectly is
     transform.rotation = Quaternion.FromToRotation (transform.position, 
 target.transform.position - transform.position);
 
               How can i rotate sprite smooth with this fucntion,or are there any other ways to do this?
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by $$anonymous$$ · Aug 29, 2014 at 07:56 AM
Fixed by using :
   transform.rotation = Quaternion.Lerp(transform.rotation,Quaternion.FromToRotation (transform.position, target.transform.position - transform.position),Time.deltaTime);
 
              Your answer
 
             Follow this Question
Related Questions
Flip over an object (smooth transition) 3 Answers
How to always rotate clockwise 1 Answer
Keep objects current rotation, with Input Mouse X 0 Answers
Why is this rotation acting odd? 0 Answers
LookRotation is upside down? 1 Answer