# First Person Camera Target

I have a camera at position P, and a normalized direction vector D (where the camera is facing). I want the target of the camera to be 5 units forward from the position. Here's my attempt:

F = (0, 0, 5) // forward
target = P + (D * F)


The obvious problem is that D * F can eventually reach (0, 0, 0), which would cause the target to be equal to the initial position. I feel like I'm missing something even more obvious than the problem here but, how would I properly have the target be 5 units forward?

• It's correct if and only if D has length of one... is that what you're getting at? Commented Feb 14, 2015 at 7:14

I was missing something incredibly obvious that makes me feel ashamed to have posted this question. All that needed to be done was to set F = (1, 1, 5) instead of zeroing out the coordinates I didn't need. It's like I forgot how to multiply.
• Simply multiply your unit vector with a scalar target = P + D * 5, that way you don't have to match up the F vectors components with the direction of your unit vector. Also select your own answer as the accepted answer, if you don't the website will automatically bring your question up to the front page periodically until you do. Commented Feb 14, 2015 at 15:04