I have been trying to include the direction vector in my model matrix, but no success. What can be wrong with this code?
[code=delphi]
function TBrainObject.GetMatrix: TBrainMatrix;
var
M: TBrainMatrix;
V: TBrainVector;
begin
if UpdateNeeded then
begin
M := Mat4CreateRotationEuler(FRotation);
V := Mat4ApplyToVector(M, Vec3(0.0, 0.0, -1.0));
V := Vec3Normalize(V);

CachedMatrix := Mat4Scale(Mat4Translate(M,
Vec3Negate(Vec3Add(FPosition, V))), FScale);

UpdateNeeded := False;
end;
Result := CachedMatrix;
end;
[/code]

What happens is that the camera doesn't include the new direction after rotation and instead moves on the same axes. Here's a video for better explanation: http://www.youtube.com/watch?v=lOL8sqR5fQ0

Do you happen to know what is wrong?

EDIT
Hm, I also thought of using a LookAt function. What do you think?
@User137: Can you post the code of the CreateMatrix function here?