How to translate Input axis into directions (in a 2D environment)?
I was trying to translate the Input Axis into directions and after hours of searching (without any luck...) and a lot of trial and error I came up with this:
Vector3 lookDirection = new Vector3(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"), 1);
Quaternion lookRotation = Quaternion.LookRotation(lookDirection, Vector3.up);
Vector2 axisDirection = new Vector2(lookRotation[1] * 2.5f, -lookRotation[0] * 2.5f);
But it's probably not ideal... Can someone tell me how to achieve this in a more clean manner, please?
Comment