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$
3
  • 1
    $\begingroup$ this should help $\endgroup$ Commented Jun 3, 2021 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
    Commented Jun 3, 2021 at 12:16
  • $\begingroup$ To clarify my comment: result matrix = lookFromZero(forward * arcball, up* arcball). Maybe it will help someone. $\endgroup$
    – nocturne
    Commented Sep 19, 2022 at 12:08

1 Answer 1

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 and acknowledge you have read our privacy policy.

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