Answers for "Xbox stick vector magnitude confusion"
http://answers.unity.com/questions/870538/xbox-stick-vector-magnitude-confusion.html
The latest answers for the question "Xbox stick vector magnitude confusion"Answer by DwaynePritchett
http://answers.unity.com/answers/870594/view.html
I don't know if I understand the issue...but...
The thing is, at best you can only give each of the inputs a 45 degree threshold. Because, 360/8 is 45.
I think you aren't considering the fact that the space around the Xbox's Analog stick isn't a square, but rather a circle. If it was normalized it would be (0.707,0.707) approximately. Because, a 45 degree angle is (root2/2). Since, you're getting some 0.8 values, the circular shape around the stick must not be a perfect "Unit Circle".
I would make a Quaternion and return the 2D Rotation Equivalent of my input as some degrees. Then use that to determine the direction you are pushing. Where,(-22.5,22.5) is Right.(22.5,67.5) is UpRight etc.
I feel like Unity has this built in, but I don't know what off the top of my head.
Hope this is somewhat helpful at least.Wed, 07 Jan 2015 12:28:23 GMTDwaynePritchettAnswer by DwaynePritchett
http://answers.unity.com/answers/870613/view.html
I didn't actually test it. But you should be able to use this and then just check in between what ranges you want.
float GetInputAngle(float xInput, float yInput){
//Get the angle ignoring quadrant. Call it rawAngle.
float absX = Mathf.Abs(xInput);
float absY = Mathf.Abs(yInput);
if(xInput > 0){
float rawAngle = Mathf.Rad2Deg*Mathf.Atan(absY/absX);
if(yInput > 0){
return rawAngle;
}
if(yInput < 0){
return 360 - rawAngle;
}
if(yInput == 0){
return 0;
}
}
if(xInput < 0){
float rawAngle = Mathf.Rad2Deg*Mathf.Atan(absY/absX);
if(yInput > 0){
return 180 - rawAngle;
}
if(yInput < 0){
return 180 + rawAngle;
}
if(yInput == 0){
return 180;
}
}
if(xInput == 0){
if(yInput > 0){
return 90;
}
if(yInput < 0){
return 270;
}
if(yInput == 0){
//This means no input.
return -1;
}
}
return -1;
}
![alt text][1]
[1]: /storage/temp/38352-anglediagram.pngWed, 07 Jan 2015 11:43:06 GMTDwaynePritchett