in

Calculate the angle of the vector between the pivot and the touch point. Check out Unity - Scripting API: Transform.Rotate

I think you could use the lookAt function Unity - Scripting API: Transform.LookAt

I dug up an old prototype I made. Dumping the code. Hope it helps.

The tracking is a loop contained in a co-routine. In the AngleToPlayer function I correct the angle by 90 degrees. This is because there was a miscommunication with my artist and I was too lazy to rotate the sprites. You might not need this.

I don’t know if this is the most elegant way though, it’s from my second or third Unity game.

```
IEnumerator TrackPlayer()
{
isTracking = true;
float rotateSpeed = 1f;
while(true) {
// Rotate
float targetHeading = AngleToPlayer();
Quaternion q = Quaternion.AngleAxis(targetHeading, Vector3.forward);
transform.rotation = Quaternion.Slerp(transform.rotation, q, Time.deltaTime * rotateSpeed);
yield return 0;
}
}
// -------
float AngleToPlayer()
{
Vector3 p2 = GameManager.player.transform.position;
Vector3 p1 = transform.position;
return Mathf.Atan2(p2.y-p1.y, p2.x-p1.x)*180 / Mathf.PI - 90;
}
```