Currently I am trying to implement shadow mapping for the sun in my game. For this I need to use glm's look at function to render the scene from the sun's perspective. Here is my code:
projection = glm::ortho<float>(-200, 200, -200, 200, -200, 400);
view = glm::lookAt(sun_pos_modelspace, -target_position_modelspace, glm::vec3(0, 1, 0)); // target needs to be negative for correct camera direction
final_matrix = projection * view;
This works fine since the scene is rendered from the sun's perspective when the game starts. But as I translate target, the view matrix seems to move from its original eye position (which is the sun's position). I do not want the eye to move at all, I just want the camera to sit at the sun's position and just look directly towards the target vector.
Should I be using some other glm function to solve this? Or am I using lookAt incorrectly?