# Looking at a Specified Point

This topic is 4588 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

In my little game i want to be able to look at a specific point in my 3d scene. If my camera is at (0, 0, 0) and i want to be able to look at (10, 0, 20) how would i do this. I understand that i need to change the gluLookAt() function. Which basically sets the camera's (eye, center, up). The Eye is the location of the camera, center is the direction the camera is pointing and up is defining what up is. So would i have to do something like this? gluLookAt(0.0, 0.0, 0.0, 10.0, 0.0, 20.0, 0.0, 1.0, 0.0); This will Make eye.x = 0.0, eye.y = 0.0, eye.z = 0.0 center.x = 10.0, center.y = 0.0, center.z = 20.0 up.x = 0.0, up.y = 1.0, up.z = 0.0 That means the camera will be at the origin and looking at the point (10.0, 0.0, 20.0). Am i correct? So if i want to look at a specific point all i would have to do is change the center to that point?

##### Share on other sites
Quote:
 Original post by gpr1megluLookAt(0.0, 0.0, 0.0, 10.0, 0.0, 20.0, 0.0, 1.0, 0.0);...So if i want to look at a specific point all i would have to do is change the center to that point?
That's correct.

1. 1
Rutin
45
2. 2
3. 3
4. 4
5. 5

• 11
• 9
• 12
• 10
• 13
• ### Forum Statistics

• Total Topics
632984
• Total Posts
3009719
• ### Who's Online (See full list)

There are no registered users currently online

×