How can I make the Roll-a-Ball ball follow the rotation of the camera?

gif examplealt text

@Hoojikee you can use the LookAt function for that, the following code works fine just change the Input.GetAxisX and Y parameters to “Vertical” and “Horizontal”, pass the reference of your ball to lookAt and camera to camTransform

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

public class CameraControl : MonoBehaviour
{
private const float Y_ANGLE_MIN = 0.0f;
private const float Y_ANGLE_MAX = 50.0f;

public Transform lookAt;
public Transform camTransform;
public float distance = 10.0f;

private float currentX = 0.0f;
private float currentY = 45.0f;
private float sensitivityX = 4.0f;
private float sensitivityY = 1.0f;

private void Start()
{
    camTransform = transform;
}

private void Update()
{
    currentX += Input.GetAxis("Mouse X");
    currentY += Input.GetAxis("Mouse Y");

    currentY = Mathf.Clamp(currentY, Y_ANGLE_MIN, Y_ANGLE_MAX);
}

private void LateUpdate()
{
    Vector3 dir = new Vector3(0, 0, -distance);
    Quaternion rotation = Quaternion.Euler(currentY, currentX, 0);
    camTransform.position = lookAt.position + rotation * dir;
    camTransform.LookAt(lookAt.position);
}

}