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 ?