How to rotate Input Axis by an angle offset

I am trying to rotate the input axis by an angle offset, depending on where the character is looking.

Vector3 input = new Vector3(Input.GetAxis(“Horizontal”), 0f, Input.GetAxis(“Vertical”));

Quaternion targetRotation = Quaternion.LookRotation (input, Vector3.up);

transform.Find (“Aim”).rotation = targetRotation;

float angle = Vector3.Angle(transform.forward, transform.Find(“Aim”).forward);

Vector3 cross = Vector3.Cross(transform.forward, transform.Find(“Aim”).forward);

if(cross.y >0)
angle =-angle;​

input = Quaternion.AngleAxis(angle,Vector3.up)*Vector3.forward;​

The Aim game object is set by the input axis. The character should still move given an X, Y axis whilst still looking at a target, using a RTS-style camera. As I am using the animator to move the character, I need to figure out how to set the blend tree coordinates to move relative to where the character is facing.

I am getting weird blending results due to the axis not being constrained to a square. A 45 degree turn results in (0.7, 0.7) instead of (1, 1). Is there a way I can stretch the Vector to snap to a 1,1 square, or a generally better way to achieve what I am working towards?

30189-axis_rotation.jpg

Here is how you do it:

    static public Vector2 GetAxis(float degrees)
    {
        var radians = ConvertDegreesToRadians(degrees);
        return new Vector2((float)Math.Cos(radians), (float)Math.Sin(radians));
    }

    static public double ConvertDegreesToRadians(double degrees)
    {
        return degrees * (Math.PI / 180);
    }

Also, if you want to convert axis to degrees, here is how:

    static public float GetDegree(Vector2 axis)
    {
        var acos = ConvertRadiansToDegrees(Math.Acos(axis.x));
        var asin = ConvertRadiansToDegrees(Math.Asin(axis.y));

        if (asin < 0)
        {
            acos = 360 - acos;
        }

        return (float)acos;
    }

    static public double ConvertRadiansToDegrees(double radians)
    {
        return radians * 180 / Math.PI;
    }

@tommehnet hope that helps!