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?