So I'm doing a VR experience and today I'm working on using the thumbsticks of the quest controller more like a gamepad to control selection of a UI menu for a trivia game that's going to be in the experience.
Now Unity returns the thumbstick via a Vector2, easy enough. I literally sketch out an XY graph, figure there's a threshold I need to account for for each direction, a much smaller threshold that we can ignore for each plus and minus on the other vector, and if the Vector2 meets all my criteria I can fire off my functions for the direction. So for UP my code looks something like
if(Vector.Y > pressthreshold and (Vector.X < threshold and Vector.X < -threshold){ Print(up!)}
And then I did that for each direction... And it kinda worked. But it was wonky as hell because my quest is old and the thumbsticks drift. So I spent like an hour and a half trying to find just the right thresholds and it just did not want to be consistent...
So I figured I'd ask chatgpt. And it basically spits out: Just take the absolute value of your X and Y and whichever one is bigger is your plane, and then the positive or negative of the value determines your direction.
ARE YOU FUCKING KIDDING ME?
I am in shambles. I have once again overcomplicated the simplest freaking thing.
TLDR: My brain is pudding. Just had to vent.