Top-Down Camera: Always looking where the player is facing?

I use this code, which I did not write, to move the camera so it’s always looking at the player, top-down 3rd person, as they move around the world. I’d like to adjust it so that when the player turns left or right, the camera moves around as well, so that the camera is always facing the same direction as the player.

[I’ve tried making the camera a child of the player object, but the result is a choppiness as the camera moves right/left with player but then gets pushed back, probably via the code]

How might I adjust this code to get the desired effect? I’m all for doing the research myself, if someone wants to point me in the right direction :slight_smile:

using UnityEngine;
using System.Collections;

public class AttachCamera : MonoBehaviour
{
	Transform myTransform;
	public Transform target;
	public Vector3 offset = new Vector3(0, 5, -5);
	
	void Start()
	{
		myTransform = this.transform;
	}
	
	void FixedUpdate()
	{
		if (target != null)
		{
			myTransform.position = target.position + offset;
			myTransform.LookAt(target.position, Vector3.up);
		}
	}
}

If you want to try the parented approach:

void Start()
{
   transform.parent = target;
   transform.localPosition = offset;
   transform.LookAt(target);
}

If not:

void Update()
{
   myTransform.position = target.position + target.TransformDirection(offset);
   myTransform.LookAt(target);
}