4 minutes ago, calioranged said:
Yes sorry I have my terminology wrong there.
What I mean is that if you have the following rotate matrix:
glm::mat4 rotator { glm::rotate(glm::mat4(1.0F),
glm::radians(degrees),
glm::vec3(rotation.x, rotation.y, rotation.z)) };
MVP.view.direction = rotator * MVP.view.direction;
Where:
degrees = 90
rotation.x = 1.0F
rotation.y = 0.5F
rotation.z = 0.0F
Then the view direction will be rotated by:
90° on the x-axis (90 * 1.0)
45° on the y-axis (90 * 0.5)
0° on the z-axis (90 * 0.0)
[Please correct me if the above is wrong] So rotation is not happening by the specified amount on one axis, it is happening by the specified amount on each axis.
I think you are wrong
- I don't use GLM, I have my own implementation. Therefore I don't know the specific function you posted, but I think they are not doing something to fancy there. What I guess it does is creating a matrix, that rotates everything 90 degrees around the axis (1, 0.5, 0)
So imagine yourself standing in a room. The x-axis is pointing into your view direction. The y-axis is pointing to your right, and the z-axis is pointing directly into the sky. You are the origin of this coordinate system. Each axis value at your location is 0.
Now think about an object directly in front of you. Let it be 2 meters away from you. So its location towards you would be described by the vector (2, 0, 0). If I tell you "please rotate by 90 degrees left" and you obey that command, the object would now be located 2 meters away on your right-hand side. So at (0, 2, 0). This is a rotation around the z-axis. What would have happened, if I told you to rotate around the y-axis? Point with your arm to your right-hand side (in direction of the y-axis) and imagine somebody grabs your arm and starts twisting it around 90 degrees. Okay, that might hurt, but imagine that instead of being hurt, your body is rotated.
Depending on the direction of the rotation, the Object will end up being 2 m above your head or 2 meters below your feet. So at (0,0,2) or (0,0,-2). So now lets come back to the vector you specified: (1, 0.5, 0)
Point your arm directly in front of you. That would be (1,0,0). Now rotate your arm a little bit to the right, so that you are not pointing directly in front of you but also not totally to the right. The direction you are pointing to is now something like this (X, Y, 0). Now imagine again, what would happen if somebody grabs your arm and rotates you around 90 degrees. Okay, the outcome might be a little bit hard to imagine unless you try it out, but one thing for sure: Since you just rotated yourself and did not change your position, the distance between you and the object remains 2 meters! The vector, which describes the object's location towards your new orientation might now have three non-zero entries (X, Y, Z), but its lengths remain 2 meters. By the way, a vector's length is calculated by sqrt(X*X + Y*Y + Z*Z)
Hope that helped a little bit in understanding what is going on.
Greetings