my enemy must have 2 rotations, the first rotation targets the world since my game is based on a spherical world but at the same time it has to rotate the forward where the player is. Tips?
// Update is called once per frame
void Update ()
{
Vector3 dire = (pianeta.position - this.transform.position).normalized;
float angleZ = Mathf.Atan2(dire.z, dire.x)*Mathf.Rad2Deg;
Vector3 tar = (target.position - this.transform.position).normalized;
float angleY = Mathf.Atan(tar.y) * Mathf.Rad2Deg;
Quaternion dir = Quaternion.FromToRotation(this.transform.right, dire) * this.transform.rotation; // direction player by world
Quaternion dirToTargetY = Quaternion.Euler(0, angleY, 0); //direction by target position
this.transform.rotation = dir;
}