I am trying to get pass this error cannot convert from 'Valve.VR.HmdMatrix34_t' to 'UnityEngine.Transform' when importing MixCast SDK. Does anyone know how to cast 'Valve.VR.HmdMatrix34_t to'UnityEngine.Transform? I've looked at https://valvesoftware.github.io/steamvr_unity_plugin/api/Valve.VR.HmdMatrix34_t.html struct and it it does not help me much.
So the problem is where to find detailed information about the HmdMatrix34_t struct, to be able to cast it to Unity Transform.
P.S. The info about the struct is valuable and can be a start point for me, but I will really price a code sample where I can see how to extract unity Vector3 for position, rotation and scale (or the full Transform).
A transformation matrix is a 4x4 array, but only 3x4 of that is really used. This is what the Valve HmdMatrix34_t
("t" for "type", it's a C thing) is. Simply inject the cell values from the HmdMatrix
into the the first three rows (or columns, I always get the precedence mixed up) of a Unity Matrix4x4
and then assign it to your transform
.
Where you may go wrong is understanding where the HmdMatrix
sits in the scene graph, and thus whether to apply it directly or use its inverse.