# lookAt that returns camera matrix instead of view matrix

I can generate the camera matrix as follows: void lookAt(vec3 center) { vec3 f = normalize(center – this->eye); vec3 u(0, 1, 0); vec3 r = normalize(cross(f, u)); u = cross(r, f); this->cameraMatrix = inverse(mat4( r.x, u.x, -f.x, 0, r.y, u.y, -f.y, 0, r.z, u.z, -f.z, 0, -dot(r, this->eye), -dot(u, this->eye), dot(f, this->eye), 1 )); //… Read More lookAt that returns camera matrix instead of view matrix