private void LoadCstMatrix(string filePath) { // Read a matrix from file and apply it to the TrackerTransform as a CST matrix. var matrix = MatrixIO.ReadMatrixFromFile(filePath); (target as TrackerBoss).SetCstMatrix(matrix); // Re-serialize target, with the cstMatrix parameters updated. var newSerialized = new SerializedObject(target); // Save the new values of the matrix, and dependant fields, to the original serializedObject. cstMatrixProperty.Matrix4x4Value(matrix); serializedObject.CopyFromSerializedProperty(newSerialized.FindProperty("cstTransformMatrix")); serializedObject.CopyFromSerializedProperty(newSerialized.FindProperty("cstScaleFactor")); }
private void LoadOffsetMatrix(string filePath) { // Read a matrix from file and apply it to the TrackerTransform as a offset matrix. var matrix = MatrixIO.ReadMatrixFromFile(filePath); (target as TrackerTransform).SetOffsetMatrix(matrix); // Re-serialize target, with the offsetMatrix parameters updated. var newSerialized = new SerializedObject(target); // Save the new values of the matrix, and dependant fields, to the original serializedObject. offsetMatrix.Matrix4x4Value(matrix); serializedObject.CopyFromSerializedProperty(newSerialized.FindProperty("offsetTranslate")); serializedObject.CopyFromSerializedProperty(newSerialized.FindProperty("offsetRotation")); }