0

Say I have a world object at point W and a camera at point C. How do I make the camera point at the object?

If I have one vector UP that is (0,2,0) how do I show the rotation matrix for this camera?

Any helpful references would be appreciated, Thanks!

KRB
  • 4,875
  • 17
  • 42
  • 54
  • not exact duplicate, but see http://stackoverflow.com/questions/349050/calculating-a-lookat-matrix for some help. – Tesserex Nov 30 '11 at 21:21
  • "point at W" is not enough. You need to say how many degrees of freedom the camera has. Can it just turn in the plane? Can it turn in 3D? Can it rotate the view? – Steve C Nov 30 '11 at 21:32

1 Answers1

1

Follow this Nehe article on cameras:
http://nehe.gamedev.net/article/camera_class_tutorial/18010/

Particularly the "Following Targets" section where it shows how to get the camera vectors for looking at an arbitrary point.

Valentin Galea
  • 1,084
  • 8
  • 18
  • That looked promising at first but I don't really understand. I'm looking to calculate the AT vertex and RIGHT vertex. In addition I'm not sure how to even go about showing the rotation matrix. – KRB Nov 30 '11 at 22:17
  • Take a look at the last picture: "AT vertex" is z', "RIGHT vertex" is x' and UP is y'. You cannot both have a fixed UP like (0,2,0) and look at a point. – Valentin Galea Nov 30 '11 at 22:24