void OnEnable() { // try and load calibration try { var CalibrationJson = System.IO.File.ReadAllText(CalibrationFilePath); CalibrationData = JsonUtility.FromJson <CalibrationParams>(CalibrationJson); CalibrationState = CalibrationStates.Finished; } catch (System.Exception e) { Debug.LogError("Didn't load calibration from " + CalibrationFilePath + ", exception=" + e.Message); } UpdateCalibrationTarget(); CreateScreenQuad(); }
void UpdateCalibration(Vector3 Position) { if (CalibrationState == CalibrationStates.Finished) { CalibrationState = CalibrationStates.CornerTopLeft; } var StateIndex = (int)CalibrationState; WorldScreenPositions[StateIndex] = Position; Debug.Log("Updated calibration " + CalibrationState); CalibrationState = (CalibrationStates)StateIndex + 1; if (CalibrationState == CalibrationStates.Finished) { SaveCalibration(); } UpdateCalibrationTarget(); CreateScreenQuad(); }