Hey,
I am currently in the process of making a nuget that enables the use of vive trackers without connected HMD. It is heavily borrowing from @tonfilm 's beta plugin.
Almost everything is working nicely but I just can’t wrap my head around the matrix / coordinate conversion from OpenVR to VL(Stride).
According to open.h OpenVR is a
right-handed system
+y is up
+x is to the right
-z is forward
Which should be the same as in Stride?
Looking at the Stride OpenVR code, the conversion is basically done like this:
Debug.Assert(Unsafe.SizeOf<Matrix>() > Unsafe.SizeOf<HmdMatrix34_t>());
Unsafe.As<Matrix, HmdMatrix34_t>(ref pose) = devicePose.mDeviceToAbsoluteTracking;
But when I do it that way the X and the Z axis are inverted.
Same happens when I do the conversion like that:
public static Matrix ToMatrix(this HmdMatrix34_t m)
{
return new Matrix()
{
M11 = m.m0, M12 = m.m4, M13 = m.m8, M14 = 0,
M21 = m.m1, M22 = m.m5, M23 = m.m9, M24 = 0,
M31 = m.m2, M32 = m.m6, M33 = m.m10, M34 = 0,
M41 = m.m3, M42 = m.m7, M43 = m.m11, M44 = 1
};
}
I can of course negate X & Z (M41/M43). But then rotations seem to be off / inverted and I really don’t get how to counter that.
Any help much appreciated.