Proper way to do compound rotation?

I am currently working on the AI for an object which tracks the player in 3D space. What I am trying to achieve involves 2 rotations:

  • Rotate object to face the player
  • Rotate object to match player’s rotation along the forward axis

My question is, can the above 2 rotations be achieved in a single call to Quaternion.RotateTowards() or should they happen sequentially? If sequentially, would the order of rotation matter?

What I currently have working only covers facing the player. How can I most efficiently add the 2nd rotation? Any help is appreciated.

private void LateUpdate()
{
    if (isTrackingPlayer)
    {
        targetDirection = player.transform.position - transform.position;
        Quaternion.RotateTowards(transform.rotation, Quaternion.LookRotation(targetDirection), Time.deltaTime * rotateSpeed);
    }
}

Always best to cascade your rotations with separate parented Transforms. Here’s an example using gun turrets, which traverse (left / right) and elevate (up / down).

Turret aiming/rotating:

Thanks for the quick reply! I’ll take a look at your examples and see how it works out.