Rigidbody movement in direction of camera?

I’m trying to make a RigidBody player move in the same direction the camera is facing. I used the good old “RigidBodyFPSWalker” script, but this makes the player move in its own forward direction and not the cameras (everytime I push up in the joystick it must go in the forward direction of the camera). How can I change the famous script in such way that i rotate the player accordingly and move in the direction of the camera? I’m guessing this RigidBodyFPSWalker is not the ideal since my game is third person :expressionless:
Thanks in advance.

bean.transform.rotation = Quaternion.Euler(0, transform.eulerAngles.y, 0); //Locks the y rotation of the player to the camera’s y rotation
transform.position = new Vector3 (bean.transform.position.x, bean.transform.position.y + 0.5f, bean.transform.position.z); //Moves the camera with the player

Since the rigidbody player is moving in its own direction, the only thing you have to do is rotate the player with the camera instead, so that the forward direction matches the camera’s viewpoint. bean is the player and this code is attached to the main camera