Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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)

share|improve this question
up vote 0 down vote accepted

Position and Target are point locations in space. The UP part is a normalized direction vector to indicate which way is up for when the matrix is built. All variants of those parameters being passed in are data tricks used to make what the engine is using match up to what the function wants to see.

For example = for a camera at origin the orientation forward could be used as the Target point directly with the camera's Position being 0,0,0.

camPos + orientation Forward gets the same result, only it factors in that the camera may not be at 0,0,0 and so it's more general in use.

The "magnitude" of where the source and target points are in space doesn't matter (outside of floating point precision), as you've noticed a change of 1->10 from Position->Target is the same as a change of 1->1_million.

Finally, all the different ways of creating the source and target points are equivalent within the limits of floating point precision.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.