# 3D camera position and LookAt?

Hi there.

Before I set off on another completely uncharted journey, I thought I’d ask…

If in a 3D game I’ve decided all the scenery is going to remain in the same position and I’m going to move the camera around, do I need to use the CreateLookAt and create an imaginary point on a sphere around ‘me’ in space to LookAt? If that’s the case can I simply use a projection or normalised copy of my rotation vector?

Many thanks.

Create look at takes a Target Position in your world so yes you can just rotate a point around with some matrices then add that to the cameras position then pass that back to the CreateLookAt function as the Target Vector.

You can alternately just create a matrix with create world or any of the rotation methods and grab the forward from it to add to your cameras position then pass it to create look at.

`````` view = CreateLookAt
(
myCameraPosition,
myUp
);

//Or

view = CreateLookAt
(
myCameraPosition,
myCameraPosition + SomeOtherObjectsPositionInWorld ,
myUp
);

//Or

camerasWorld = CreateWorld
(
camPosition,
Vector3.Normalize(new Vector3(5,0, 2)),
Vector3.Up
);

//then

view = CreateLookAt
(
camerasWorld.Translation ,
camerasWorld.Translation + camerasWorld.Forward,
camerasWorld.Up
);
``````

The two methods are a little different CreateWorld takes a Forward Vector as if its just a direction were CreateLookAt takes a actual position to look at in world space and figures out the forward direction by comparison to the previous position you just gave it.

Conceptually …

CreateWorld is for creating (world) objects orientation matrices in world space for all your game objects that are typically drawn, However this can include the camera as if it were a physical object in your world that moves and looks around though the camera is typically not drawn.

CreateLookAt is for creating the special requisite (view) matrice that typically endures for a single frame unchanged, from one of those objects that acts as your camera.