how do i change the direction of my player using the camera's Y rotation

if the camera’s Y rotation = 0 then i want my player to move in the +Z direction, so how do i do this

its a 3-D game, I’m using Rigid Body to move my player, transform to rotate my camera.
i can change the movement / rotation if needed to Rigid Body or Transform.

by the way i’m using c#.

Try something like this:

Transform camera;
public float speed = 5;

void Start()
camera = GameObject.FindGameObjectWithTag("MainCamera").transform;

void FixedUpdate()
Vector3 forward = camera.forward;
transform.forward = forward;
GetComponent<Rigidbody>().Addforce(forward * speed);

This code is intended to be attached to the player game object.