How would I get a normalized vector2D from an angle?
i.e. if I put in an angle of 90 I would get the vector (0,1) because it would be straight up.
If I put in the angle 0 (which is to the right) I would get the vector (1,0).
Multiply a vector by Quaternion to rotate it. Multiply a normalized vector and you’ll get a normalized result.
void Start ()
{
Vector2 v1 = Quaternion.Euler(0, 0, 0) * Vector3.up;
Vector2 v2 = Quaternion.Euler(0, 0, 90) * Vector3.up;
Vector2 v3 = Quaternion.Euler(0, 0, 180) * Vector3.up;
Vector2 v4 = Quaternion.Euler(0, 0, 270) * Vector3.up;
Debug.Log(v1); //(0.0, 1.0)
Debug.Log(v2); //(-1.0, 0.0)
Debug.Log(v3); //(0.0, -1.0)
Debug.Log(v4); //(1.0, 0.0)
}
You say (1,0) is up? Normally the X axis is the horizontal one but as long as you stay true to the coordinate system you choose and choose the right kind of vector to start rotatting, you should get the results you want.