I've read multiple tutorials, but I still can't understand how do I properly rotate an object in 3D space on all 3 axis at once. For example, I'd like to give the object a pitch of 60 degrees, yaw of 20 degrees and roll of 70 degrees. How can I properly do this in OpenGL, preferrably using GLM?
$\begingroup$ $\endgroup$
6 - 1$\begingroup$ "I'd like to give the object a pitch of 60 degrees, yaw of 20 degrees and roll of 70 degrees." Why? Why do you want to do this thing? $\endgroup$Nicol Bolas– Nicol Bolas2019-06-17 05:36:32 +00:00Commented Jun 17, 2019 at 5:36
- $\begingroup$ OpenGL has nothing to do with that. GLM might very well regarding the implementation (but in turns has nothing to do with OpenGL either). But ultimately that's a purely mathematic problem, the practical implementation of which depends on a lot more things than if you're using GLM. And even the mathematical theory of which depends on a few other unclarities, e.g. what "pitch", "yaw" and "roll" even mean in your context and what exactly you want your object to behave like. $\endgroup$Christian Rau– Christian Rau2019-06-17 11:17:24 +00:00Commented Jun 17, 2019 at 11:17
- $\begingroup$ @Nicol Bolas Because those are all the three rotation values that an object can take at a time. Such thing is needed for example, in games with planes and helicopters, since they can turn around these 3 axis all at the same time. $\endgroup$John– John2019-06-17 14:27:12 +00:00Commented Jun 17, 2019 at 14:27
- $\begingroup$ @Nicol Bolas Nevermind, I just realised that the answer is simpler than I first thought. I think that simply creating a rotation matrix for each axis and then multiplying them would do the trick. $\endgroup$John– John2019-06-17 17:37:45 +00:00Commented Jun 17, 2019 at 17:37
- 1$\begingroup$ And then you'll be back tomorrow asking about Gimbal Lock or other similar Euler angle problems. $\endgroup$Nicol Bolas– Nicol Bolas2019-06-17 17:39:16 +00:00Commented Jun 17, 2019 at 17:39
| Show 1 more comment