1
$\begingroup$

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.

$\endgroup$
2
  • 1
    $\begingroup$ this should help $\endgroup$ Jun 3 at 11:20
  • 1
    $\begingroup$ I somehow managed to do it with multiplying the arcball matrix with something like product(look_from_zero) of forward and up vector (I did not use left vector). But thanks. $\endgroup$
    – nocturne
    Jun 3 at 12:16
1
$\begingroup$

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.