How to use trackball for rotating an camera matrix in eye frame I have a QOpenGLWidget where I use camera transformation matrix(4,4), FOV and vectors Position(4), Up(4), Forward(4). I also have an ArcBall which I can use. I managed to implement zoom and pan by modifying the Position vector. Now I want to implement rotation with arcball.
On mouseMove I compute the rotation matrix with arcball. Then I need to use this matrix for rotating the camera. Now how do I do that?
I tried multiplying or summing the camera matrix and arcball matrix but it is not working for me.
I'm assuming the rotation matrix generated from the arcball is 2D, so I think there are a few clear top level steps. But I'm not sure about the details of some of them.
First you'll need to extend the 2D rotation to 3D which should be easy.
Next you'll need to rotate the rotation matrix itself so its axis aligns with your Forward vector. I'm not certain how to do this step.
Then, use the resulting matrix to transform the Up vector and reconstruct the camera matrix using the new vector and the other values and vectors.