I’ve been learning advanced CFrame, like CFrame matrix. I’m a bit confused though.
In the image below me, I used a script to find the components of the current CFrame of the grey object. The transparent axes represent the global axes and the opaque ones represent the local axes.
In 3D affine transformation, rotation around an axis can be defined with the following matrices:
If we took your first example, rotating 90 degrees around the y-axis, then cos(90 degrees) is 0 and sin(90 degrees) is 1.
Plugging these numbers into the Ry matrix, we multiply Ry (matrix B) with the starting identity matrix shown in the first image (matrix A) to apply the transformation on the cube.
Taking a look at your second image, we get the correct resulting matrix.
Then, if we multiplied this matrix AB with another matrix rotating 45 degrees on the z-axis, we get the following resultant matrix.
This is in line with the result in your final image. (As for why it’s -0.8 instead of -0.7 in your image, it could be because of a floating point error, since both cos(45) and sin(45) are 1/sqrt(2), which is an irrational number that I just rounded down to 0.7).