Camera follow ball along cylinder

In my game I have a ball that rolls along a cylinder and can also rotate around it.

The camera script I currently have looks like this:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CameraController : MonoBehaviour
{
    private GameObject player;
    private Vector3 offsetPosition;

    void Start()
    {
        player = GameObject.FindGameObjectWithTag("Player");
        offsetPosition = transform.position - player.transform.position;
    }

    void LateUpdate()
    {
        transform.position = player.transform.position + offsetPosition;
    }
}

So it simply follows the ball.
When I rotate the ball around the cylinder it looks like this

How can I modify the camera script so the camera view stays the same and rotates with the ball around the cylinder?

Hello, have you managed to solve this problem? I need it in the same way. Thanks :slight_smile: