# Does it matter what gluLookat's center value is?

• 04-06-2007
indigo0086
Does it matter what gluLookat's center value is?
Like when I'm just testing I change the

Code:

```    gluLookAt(0.0, 0.0, 10.0,               0.0, 0.0, -1.0,               0.0, 1.0, 0.0);```
to
Code:

```    gluLookAt(0.0, 0.0, 10.0,               0.0, 0.0, -100.0,               0.0, 1.0, 0.0);```
and it doesn't make a difference, at least when displaying simple shapes. Does the magnitude of the center vector matter, or is it like the up vector where it can be either negative, positive, or zero despite the magnitude.
• 04-07-2007
VirtualAce
I'm not familiar with the parameters to that function or I could tell you just from a pure '3D math' standpoint.

Essentially the look at functions in both GL and D3DX build a RH or LH look at matrix. If you have a book on 3D graphics you will probably see this derived in the book at some point.
You can also google for 'look-at matrix'

I use the look at matrix in my space 'project' (not really a game yet per se) for flyby camera views. As the object moves I compute the new look at matrix each frame and set the view matrix to that matrix. Works like a charm.
In order to offset the camera a bit to make the effect complete I set the viewpoint at some point along the object's velocity vector and randomize the offsets for up and right. This produces a viewpoint just ahead and above/below or right/left of the object as it flies by the camera.
• 04-07-2007
jverkoey
The center vector is the look at vector, and is normalized to a length of 1.0.
• 04-07-2007
KONI
The definition of gluLookAt is:
Code:

```gluLookAt(eyePosX, eyePosY,  eyePosZ,                   viewDirX, viewDirY, viewDirZ,                   upX, upY, upZ)```
Here you can see that the middle vector is actually made up of directions, and there's not difference between -1 and -100 (as for directions). Or, like jverkoey has said, the vector is normalized to 1 :)