I need to set directly the Y-Rotation of the player to be equal to the Camera.main
Y-Rotation I have searched a lot but can't find the answer.
I know it is simple but I can't manage it.
Edit: I tried this code
transform.rotation = Quaternion.Euler(Camera.main.transform.eulerAngles);
But it set the rotation of the whole rotation of the object equal to the rotation of the camera X,Y,and Z but what I want is to set only the y rotation.Thanks for help.
I forgot to say whay I am using this in I am making a VR Game so when the player rotates his head the camera rotates successfully.
Note: Why I want to do that? because when my player has to move forward it has to have the same y rotation of the camera.