public void Rotate(Vector2 value)
        {
            x += value.y * (invertY ? -1f : 1f);
            y += value.x * (invertX ? -1f : 1f);

            if (clampX)
            {
                x = RangeMath.ApplyMinMax(x, xRange);
            }
            if (clampY)
            {
                y = RangeMath.ApplyMinMax(y, yRange);
            }

            transform.eulerAngles = new Vector3(x, y, 0);
        }
Example #2
0
        public void Rotate(float input)
        {
            value += input * (invert ? -1f : 1f);
            if (clamp)
            {
                value = RangeMath.ApplyMinMax(value, range);
            }

            switch (rotationAxis)
            {
            case Axis.X: self.eulerAngles = new Vector3(value, self.eulerAngles.y, self.eulerAngles.z); break;

            case Axis.Y: self.eulerAngles = new Vector3(self.eulerAngles.x, value, self.eulerAngles.z); break;

            case Axis.Z: self.eulerAngles = new Vector3(self.eulerAngles.x, self.eulerAngles.y, value); break;
            }
        }