Question bout Using gluLookAt();
Hello all,
I am having some trouble getting gluLookAt() to work properly.
I created a very small world to look around in, but I can not rotate properly with gluLookAt(). I have relized that to look left, you can not just set EyeX += 1.0f, becuase it dosn''t not work correctly.
Is there any equations or something i can use to rotate properly with gluLookAt?
Thanks,
Jack
To look left, you move the lookat point to the left, not the eye. To do it properly, you would rotate the lookat point around the eye.
Steve ''Sly'' Williams Code Monkey Krome Studios
Steve ''Sly'' Williams Code Monkey Krome Studios
You need to have a rotation angle, and when you press left, increase it, right, decrease it. the dirx value = sin(angle) and the dirz value = cos(angle). If you want to be able to look up and down, the eyey value = sin(pitch) and you need to scale the x and z values by cos(pitch). So we have:
dirx = sin(yaw) * cos(pitch);
diry = sin(pitch);
dirz = cos(yaw) * cos(pitch);
this will give you the direction from the two angles. to get the actaul eye point you nedd to add the direction vector to the position vector.
FatalXC
dirx = sin(yaw) * cos(pitch);
diry = sin(pitch);
dirz = cos(yaw) * cos(pitch);
this will give you the direction from the two angles. to get the actaul eye point you nedd to add the direction vector to the position vector.
FatalXC
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement