I came across this tutorial on how to create a movable camera in OpenGL using glm::lookAt(glm::vec3 position, glm::vec3 target, glm::vec3 up)
. In the tutorial, in order to keep the camera always facing in one direction while moving, the view matrix is created as such: view = glm::lookAt(cameraPos, cameraPos + cameraFront, cameraUp);
, where cameraPos, cameraFront, and cameraUp are all glm::vec3
type.
What I would like to ask is why does the second argument have to be cameraPos + cameraFront
? If the camera position moved to the right without changing cameraFront
, wouldn't cameraPos + cameraFront
have an effect of rotating to the right as opposed to staying in the same direction (which I think is what should be needed)?