So i have been working on matrices a lot lately and i have discovered a interesting thing in that monogame xna while claiming to be a right handed coordinate system is using a left handed rotation system in world space this will be the M11 element or the first element.
Basically it is internally inside the matrices using
The renderman system for rotations.
https://www.evl.uic.edu/ralph/508S98/coordinates.html
Vector wise it uses the open gl standard definition.
Vector3.Right {X:1 Y:0 Z:0}
Vector3.Up {X:0 Y:1 Z:0}
Vector3.Forward {X:0 Y:0 Z:-1}
https://www.evl.uic.edu/ralph/508S98/coordinates.html
This has some interesting implications. Ill show these in a moment after i point out more fully the meaning of what i just said.
Lets create a RotationZ matrix with zero degrees of radians and print it.
If our coordinate system in world space was really right up forward we should get a matrix
With a negative z coordinate just like our system vector Vector3.Forward.
Matrix.CreateRotationZ(0f);
Matrix is Normalized Matches MG LH Matrix. Orientation
: 1.00 0.00 0.00 0.00 X is Right
: 0.00 1.00 0.00 0.00 Y is Up
: 0.00 0.00 1.00 0.00 Z is Forward
: 0.00 0.00 0.00 1.00
As you see however instead we get a matrix equal to identity.
You might think well we just picked the wrong rotation matrix.
So lets try this with create world.
A CreateWorld matrix from System Vectors Forward Up and a Vector3.Zero for position.
Remember these are are system vectors describing a right handed coordinate system
Right {X:1 Y:0 Z:0}
Up {X:0 Y:1 Z:0}
Forward {X:0 Y:0 Z:-1}
Matrix m = Matrix.CreateWorld(Vector3.Zero, Vector3.Forward, Vector3.Up);
Matrix is Normalized Matches MG LH Matrix. Orientation
: 1.00 0.00 0.00 0.00 X is Right
: 0.00 1.00 0.00 0.00 Y is Up
: 0.00 0.00 1.00 0.00 Z is Forward
: 0.00 0.00 0.00 1.00
We get yet again however a identity matrix of the LH rotation system type.
By this i mean that our Forward vector int the matrix as you can see is (0,0,1) not -1
From this lets say we want to put in negative Forward that has a positive z coordinate to create world you can visualize this on either hand with your thumb up and your index finer pointing back toward you. If the Right value in the resulting matrix is negative you have a left handed system.
if the right vector is positive a right handed system.
What will we get ?
A create world matrix from System Vectors neg -Forward / Vector3.Backwards and the Up
Matrix is Normalized Matches MG LH Matrix. Orientation
: -1.00 0.00 0.00 0.00 X is Left
: 0.00 1.00 0.00 0.00 Y is Up
: 0.00 0.00 -1.00 0.00 Z is Back
: 0.00 0.00 0.00 1.00
What does this mean ?
Well if you wanted you could set up things in render man coordinates in a world matrix provided you didn’t call the CreateWorld function on them and set your models up also go forward in the z direction. Basically just like on a graph with the bottom left as the coordinate origin to the top right. Because the identity matrix in monogame has a positive value of 1 for its Right Up Forward and that is the renderman rotational coordinate system which is left handed. While our vectors themselves describe a right handed open gl coordinate system.
This is actually pretty cool because you get clockwise rotation with the traditional -z depth at the same time basically you get the best part of both systems.
Thought someone might find this to be a cool bit of info.