I want to rotate the camera 30° view = glm::rotate(view, glm::radians(-30.0f), glm::vec3(1, 0, 0));
and then move it forward along the new forward axis view = glm::translate(view, glm::vec3(0, 0, 1));
. Is this hard to achieve without having to use glm::lookAt function?
Asked
Active
Viewed 236 times
0

Nicol Bolas
- 449,505
- 63
- 781
- 982

John Smith
- 33
- 5
-
1Have you tried putting those lines one after the other? If that doesn't work, try applying the transformations in reverse order. – HolyBlackCat Jan 03 '19 at 11:35
-
see [Understanding 4x4 homogenous transform matrices](https://stackoverflow.com/a/28084380/2521214) especially the last sublinks ... you can extract the forward direction directly from camera matrix ... but beware cumulated ModelView matrix is not a camera matrix and also camera matrix is usually inverse ... – Spektre Jan 03 '19 at 18:44