Beispiel #1
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();
        }
        public void Move(StylusAxis axis, float value)
        {
            switch (axis)
            {
            case StylusAxis.X:
                _input.HMUTransform.localPosition += Vector3.right * value;
                break;

            case StylusAxis.Y:
                _input.HMUTransform.localPosition += Vector3.up * value;
                break;

            case StylusAxis.Z:
                _input.HMUTransform.localPosition += Vector3.forward * value;
                break;
            }

            CalibrationManager.SaveHMUTransform(_input.HMUTransform);
        }
        public void Rotate(StylusAxis axis, float value)
        {
            switch (axis)
            {
            case StylusAxis.X:
                _input.HMUTransform.Rotate(Vector3.right, value);
                break;

            case StylusAxis.Y:
                _input.HMUTransform.Rotate(Vector3.up, value);
                break;

            case StylusAxis.Z:
                _input.HMUTransform.Rotate(Vector3.forward, value);
                break;
            }

            CalibrationManager.SaveHMUTransform(_input.HMUTransform);
        }