How to make the character move in the direction the camera is facing?

So I am using cinemachine for my third-person camera and I got the camera movement part down, but if I move the camera the player doesn’t move in the way the camera is facing and that would make the character really hard to control if the player isn’t facing the way the camera. I don’t know where to start when it comes to stuff like this so help would be nice.

my playerMovement script:

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

public class BallController : MonoBehaviour
{
    public float speed = 5f;
    private Rigidbody rigid;
    public float UpForce = 500f;
    private bool isGrounded;
    public Rigidbody rb;
    public Transform cam;

    private void Start()
    {
        rigid = gameObject.GetComponent<Rigidbody>();
    }

    private void FixedUpdate()
    {
        if (Input.GetAxis("Vertical") < 0) 
        {
            rigid.AddForce(-Vector3.left * speed);
        }
        else if (Input.GetAxis("Vertical") > 0)
        {
            rigid.AddForce(Vector3.left * speed);
        }

        if (Input.GetAxis("Horizontal") > 0)
        {
            rigid.AddForce(Vector3.forward * speed);
        }
        else if (Input.GetAxis("Horizontal") < 0)
        {
            rigid.AddForce(-Vector3.forward * speed);
        }

        if (rb.position.y < -1f)
        {
            FindObjectOfType<GameManager>().EndGame();
        }
    }

    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space) && !isGrounded)
        {
            rigid.AddForce(Vector3.up * UpForce);
            Debug.Log("Jumped");
            isGrounded = true;
        }

    }

    private void OnCollisionEnter(Collision other)
    {
        if (other.gameObject.CompareTag("Ground"))
        {
            isGrounded = false;
        }
    }
   
    
}

Hello.

If don’t know where to start, take it easy, its a long way, but you need to do it by yourself. What you are asking is really simple and basic.

First, Create a vector3 in the world that points where the camera is facing. So use the vectior ahead of the camera object.

Then just make the character to face that direction and move the character with local transform, so 1,0,0 is forward.

100% recommended to go look for tutorials on youtube about scripting and Unity.