Question about Target parameter of Matrix.CreateLookAt

Posted by manning18 on Game Development See other posts from Game Development or by manning18
Published on 2012-07-11T05:08:00Z Indexed on 2012/07/11 9:23 UTC
Read the original article Hit count: 370

Filed under:
|
|

I have a newbie question that's causing me a little bit of confusion when experimenting with cameras and reading other peoples implementations - does this parameter represent a point or a vector?

In some examples I've seen people treat it like a specific point they are looking at (eg a position in the world), other times I see people caching the orientation of the camera in a rotation matrix and simply using the Matrix.Forward property as the "target", and other times it's a vector that's the result of targetPos - camPos and also I saw a camPos + orientation.Forward

I was also just playing around with hard-coded target positions with same direction eg 1 to 10000 with no discernible difference in what I saw in the scene.

Is the "Target" parameter actually a position or a direction (irrespective of magnitude)? Are there any subtle differences in behaviors, common mistakes or gotchas that are associated with what values you provide, or HOW you provide this paramter? Are all the methods I mentioned above equivalent? (sorry, I've only recently started and my math is still catching up)

© Game Development or respective owner

Related posts about XNA

Related posts about math