Example #1
0
        /// <summary>
        /// Set and saves the offset
        /// </summary>
        /// <param name="offset">Position offset of the stylus</param>
        public static void SetOffset(Vector3 offset)
        {
            var data = new CalibrationPreferences.Data(CalibrationPreferences.CalibrationData)
            {
                Offset = offset
            };

            CalibrationPreferences.CalibrationData = data;
            CalibrationPreferences.Save();
        }
Example #2
0
        /// <summary>
        /// Add axis value to offset of the calibration file.
        /// </summary>
        /// <param name="axis">Axis type (x,y,z)</param>
        /// <param name="value">Additive offset value</param>
        public static void AddValueToAxis(StylusAxis axis, float value)
        {
            var data   = new CalibrationPreferences.Data(CalibrationPreferences.CalibrationData);
            var offset = data.Offset;

            offset     += Vector3.right * ((axis == StylusAxis.X) ? value : 0);
            offset     += Vector3.up * ((axis == StylusAxis.Y) ? value : 0);
            offset     += Vector3.forward * ((axis == StylusAxis.Z) ? value : 0);
            data.Offset = offset;
            CalibrationPreferences.CalibrationData = data;
            CalibrationPreferences.Save();
        }