Winegums
04-06-2006, 10:40 AM
Hi, I did find a thread on this after searching but I wasn't able to see how to apply it to my problem.
I have a camera controlled by this lookat:
gluLookAt(
WWA[0], //Where we're at
WWA[1],
WWA[2],
WWA[0] + sy * cp, //Where we're looking at (based on where we're at)
WWA[1] - sp,
WWA[2] + cy * cp,
0, //Which direction is up
1,
0
); WWA is a 3 element float array (Where We're At). The program checks for mouse movement with the following code:
yaw += (CompareValues(MousePos.oldx, MousePos.x)/100);
pitch += (CompareValues(MousePos.oldy,MousePos.y)/100);This has worked in that I have a camera that rotates using the mouse. However I have a problem with translating the camera. I want to be able to move it in the direction it is facing, but am unable to figure out how to move it in the direction it is facing. I have tried outputting the numerical values for the position and where the camera is looking, but this has not helped at all (they are identical with the exception of a change in the z-axis).
I have a camera controlled by this lookat:
gluLookAt(
WWA[0], //Where we're at
WWA[1],
WWA[2],
WWA[0] + sy * cp, //Where we're looking at (based on where we're at)
WWA[1] - sp,
WWA[2] + cy * cp,
0, //Which direction is up
1,
0
); WWA is a 3 element float array (Where We're At). The program checks for mouse movement with the following code:
yaw += (CompareValues(MousePos.oldx, MousePos.x)/100);
pitch += (CompareValues(MousePos.oldy,MousePos.y)/100);This has worked in that I have a camera that rotates using the mouse. However I have a problem with translating the camera. I want to be able to move it in the direction it is facing, but am unable to figure out how to move it in the direction it is facing. I have tried outputting the numerical values for the position and where the camera is looking, but this has not helped at all (they are identical with the exception of a change in the z-axis).