Hey all,
I’m trying to make a sprite rotate around another one (or a point) at a constant distance.
I tried to lookat the point then apply translate on the rotating object. But the movement is weird :
Here’s my code :
Vector3 v3 = targetTransform.position - transform.position;
float angle = Mathf.Atan2(v3.y, v3.x) * Mathf.Rad2Deg;
//The translate :
transform.Translate (Vector3.up * movementSpeed * Time.deltaTime);
//The lookat :
qTo = Quaternion.AngleAxis (angle, Vector3.forward);
transform.rotation = qTo;
Where am I wrong ?
Thanks !
