Please help me to learn how to rotate the camera around the rigidbody properly

The problem is that the camera has a wider rotation than the rigidbody, I tried to make the offset wider but to no avail. Here’s the code I used.

public class NewCamScript : MonoBehaviour {

public Rigidbody target;

public float yawInput = 0.0f;
public float yawSpeed = 50.0f;
public float currentRot = 10.0f;
public float rotMin = 5.0f;
public float rotMax = 15.0f;

// Update is called once per frame
void Update () {
	if(Input.GetKey(KeyCode.RightArrow))if(Input.GetKey(KeyCode.LeftArrow))
	yawInput -= Input.GetAxis ("Horizontal") * yawSpeed * Time.deltaTime;//pressing left/right arrows or "a" and "d" will rotate the camera
	yawInput = Mathf.Clamp(currentRot,rotMin,rotMax);
}
// Updates every frame a little later
private void LateUpdate()
{
	transform.RotateAround (target.position, Vector3.up, yawInput);//rotates the camera around the player (rigidbody = target)
}

}

Good day.

If your camera will be always rotating the same GameObject (lets say “Player”), and is not a “flying moving arround camera” Is much more easy to Create an emptyObject, child of Player, with center at the Player position.

Anc make the camera child of this EmptyObject, but with an offset. This way you only need to change the Localrotation of this emptyObject.

BYEE