# Rotate an object to face a point with glm::lookAt

I want to rotate an object to face a point, such as the monster look at the player.

For that I've decided to use the glm::lookAt function. However the following does not yield good results:

const glm::mat4 transformation = glm::lookAt(ghostPosition, cameraPosition, glm::vec3(0, 1, 0));
ghost.transformation = transformation;


The ghost is correctly oriented to the player but is located to the world origin. However the following works correctly (position and orientation):

const glm::mat4 transformation = glm::inverse(glm::lookAt(ghostPosition, cameraPosition, glm::vec3(0, 1, 0)))


But I don't get why I need to inverse the matrix ?

Because the lookAt function is to position the camera to look at an object (not for an object to look at another object) and the way 3D cameras work is that mathematically they move the entire world the opposite way and the screen stays at the origin.