Hi,
I’ve got a camera set up with a vector for x,y,z position. I have the camera’s xrot and yrot (no z rotation is needed). How do I get the direction the player is looking?
I did try:
Vector3f dir = new Vector3f();//camera.getCameraPosition();
float yRotRads = (float)Math.toRadians(camera.getCameraYaw());
float xRotRads = (float)Math.toRadians(camera.getCameraPitch());
float cosY = (float)Math.cos(yRotRads);
dir.x = (float)Math.sin(xRotRads) * cosY;
dir.y = (float)-Math.sin(yRotRads);
dir.z = (float)-Math.cos(xRotRads) * cosY;
Reason I’m asking is I want to cast a ray from the direction the camera is facing. Am I over complicating this?! Sorry, my brain is a bit ‘mushy’.
Thanks