ARTICLE AD BOX
I am writing a game engine in OpenGL and C++ and I am just getting onto camera controls.
I have tried to use a parent child approach with a standard model matrix for the view matrix. That model matrix is a camera arm and a camera object parented together. I want an RTS style camera that rotates around a point so if you rotate the camera base the camera will rotated around the camera base. For some reason it does not work properly so I looked into using something different which is a function in glm that is called lookat.
The function works great. My object is still in the center when I apply rotation to the camera which is what I want. There is a huge problem though... All my objects coordinates are flipped. Things that were on the right side are now on the left side and the texture is also reversed.
I don't know enough about math's to understand what is going on.
Here is my look at line :
camera->view = glm::lookAt( camera->lens->transform->position->ToGLM(), camera->transform->position->ToGLM(), glm::vec3(0.0f, 1.0f, 0.0f));This takes the camera base (0,0,0) and the camera lens (0,0,-10) to find the look vector.
I don't think I have done anything funny in that line and without this line everything is not inverted.
I tried inverting the matrix but nothing happened.
Just to state again, using a world model matrix for the camera and lens didn't work as rotating the camera base just seemed to rotate the lens on the spot. the look at function works but has everything flipped.
Update > I think everything is just being rendered from behind and I flipped my camera position to +10 and rotated it 180 and it showed me an inverted image while using the normal matrix.
Somehow the lookat function is going the wrong way, does anyone know how to reverse this vector so it points the other direction?
How could I fix this?
