/// <summary> /// Called whenever new mobile pose is sent to VRidge. /// </summary> private void OnNewSyncPose(float[] poseMatrix) { /* Android's Matrix is column-major while .NET's Matrix3D uses row-major layout * therefore matrix transposition is required */ Matrix3D currentData = new Matrix3D( poseMatrix[0], poseMatrix[4], poseMatrix[8], poseMatrix[12], poseMatrix[1], poseMatrix[5], poseMatrix[9], poseMatrix[13], poseMatrix[2], poseMatrix[6], poseMatrix[10], poseMatrix[14], poseMatrix[3], poseMatrix[8], poseMatrix[11], poseMatrix[15] ); // Override position with absolutely placed position currentData.OffsetX = position.X; currentData.OffsetY = position.Y; currentData.OffsetZ = position.Z; // Override original matrix data with our modified matrix Array.Copy(currentData.FlattenAsColumnMajor(), poseMatrix, 16); // Arrays are passed by reference so calling method will have modified data }