Hello,
I have a question about how Urho deals with rotation through Quaternions and Matrices. I just don’t understand it anymore after looking at it for a long time.
So given the conventions: https://urho3d.github.io/documentation/1.7/_conventions.html
It says ‘positive rotation is clockwise’. I think this means if you look from the origin in the direction of the axis.
So I put 90 degrees on X:
Urho3D::Quaternion test;
test.FromEulerAngles(90.f, 0.f, 0.f);
Now I convert it to a Rotation matrix:
Urho3D::Matrix4 test_mat = test.RotationMatrix();
Now, I want to convert a vector that’s aiming UP, so: 0, 1, 0.
Urho3D::Vector3 test_vec(0,1,0);
Now I’m gonna rotate that vector 90 degrees over the X axis. You’d expect it to be -1 on Z right? wrong, it becomes +1 on Z.
Urho3D::Vector3 result2 = test_mat * test_vec;
What’s happening? It makes no sense.
Thanks for reading.
edit: I’ve just come to the conclusion that the convention is just lying, and it is actually following DirectX convention where rotation is negative angles (so looking from the axis towards the origin).
Furthermore, you guys should probably add in the conventions that matrices are stored in memory in column-major order. It’s specified nowhere but it’s kind of crucial to know. Also, the operator* on matrix4 class that takes vector3/vector4 are treating the vector as row-major vector, but mathematical convention is that M*v means that the vector is a column vector. Again, this crucial info is specified nowhere in your documents.