Jump to content
  • Advertisement
Sign in to follow this  
gpr1me

Looking at a Specified Point

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by gpr1me
gluLookAt(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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!