I’m trying to find a vector which is facing the direction of the camera and is parallel to the x-axis so that I can apply an even force regardless of the x-rotation of the camera. What I have below works but I feel like it’s sloppy and there’s another way. Is there and if so, what is it?
float camAngle;
Vector3 moveDirection;
camAngle = Camera.main.transform.eulerAngles.x;
Camera.main.transform.eulerAngles = new Vector3(0, Camera.main.transform.eulerAngles.y, Camera.main.transform.eulerAngles.z);
moveDirection = Camera.main.transform.TransformDirection(Vector3.forward);
Camera.main.transform.eulerAngles = new Vector3(camAngle, Camera.main.transform.eulerAngles.y, Camera.main.transform.eulerAngles.z);