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.
Yeah, preventing diagonals was my original intention with the secondary threshold, but these thumbsticks are so unreliable that I think I'm better off sticking to a single axis. Originally I was gonna go with a grid of 2 x 2 for my answers, but there's no reason I can't simplify them to a single column. Also, this trivia thing is occurring within the confines of a lewd game so simplifying it would also probably help with keeping the player from getting flustered. I am intending a time limit on it.๐โโ๏ธ
If that's the case, you might want to arrange your options in a diamond and have selection work as up/left/right/down, and instead of navigating and pressing A, have option select be by holding the stick in a cardinal direction for a duration. Sort of like how a weapon wheel works. I'm struggling to think of an example that's been implemented somewhere that makes this more clear but I'm gonna go scour youtube real quick
e: it's called a radial menu. Possibly consider a radial menu - all you have to do is take a
tan(x_value / y_value)
and compare it to some ranges for up/left/down/right, it's button-free and from a UX perspective it's less likely to result in a misinputIf it's not like a core mechanic of the entire game don't go to all this trouble though lmao I'm just passionate about UX
Oooh. I don't know if I'll implement it, but that is a good idea, thanks! It's certainly got the juices flowing. Anything that reduces the amount of times they fumble around looking for a button would be helpful.
I didn't play it but didn't Mass Effect do something like that with their dialogue options?