<p>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.</p>
<p>First you'll need to extend the 2D rotation to 3D which should be easy.</p>
<p>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.</p>
<p>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.</p>

CC BY-SA 4.0
2021-04-30T18:21:12.343Z
2021-05-06T16:43:41.407Z
2021-05-06T16:43:41.407Z
luser droog
<p>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.</p>
<p>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?</p>
<p>I tried multiplying or summing the camera matrix and arcball matrix but it is not working for me.</p>

CC BY-SA 4.0
2021-06-03T11:20:22.603Z
[this](https://www.3dgep.com/understanding-the-view-matrix/#Arcball_Orbit_Camera) should help
rustyBucketBay
CC BY-SA 4.0
2021-06-03T12:16:58.203Z
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.
nocturne
CC BY-SA 4.0
2022-09-19T12:08:37.073Z
To clarify my comment: result matrix = lookFromZero(forward \* arcball, up\* arcball). Maybe it will help someone.
nocturne
<opengl><transformations><c++><camera><camera-matrix>
How to use trackball for rotating an camera matrix in eye frame
nocturne
# How to use trackball for rotating an camera matrix in eye frame

(Asked by: username_0 on 2021-04-30)

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.

**Tags:** opengl, transformations, c++, camera, camera-matrix

> **Comments:**
> **username_1**: [this](https://www.3dgep.com/understanding-the-view-matrix/#Arcball_Orbit_Camera) should help  
> **username_0**: 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.  
> **username_0**: To clarify my comment: result matrix = lookFromZero(forward \* arcball, up\* arcball). Maybe it will help someone.  

---

## 1 answers

### Answer by username_2 on 2021-04-30. Score: 1

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.


---

