- Home /
Using Right Joystick to Select Weapon in Weapon Wheel
Hey everyone!
I'm currently doing a top down shooter game and am accommodating inputs for keyboard AND controllers. Everything works fine with mouse and keyboard, but I'm now trying to select weapons from a circular weapon wheel with the right joystick and am wondering how to go about it. The weapon wheel isn't finalized so I want this option to be malleable.
If any of you have ever done something similar I'd love to know how you went about it. Code would be helpful but not necessary. The objects in the weapon wheel are UI Buttons.
Thanks!
Chancey
Answer by FortisVenaliter · Feb 17, 2017 at 09:03 PM
The Unity UI Buttons won't help with this... you'll have to write your own UI code for it. Basically, you want to organize the selection options around the circle, then take the input axis data and use Atan2 to convert those into an angle. From there, it's as simple as seeing which option has the closest angle to the one represented by the thumbstick.
Your answer
Follow this Question
Related Questions
Logitech G27 pedal input 1 Answer
360 Trigger Pressing both Triggers at the same time 1 Answer
Gamecube Controller joystick axis does not work? 0 Answers
How to replace input axis keyboard button with touch button? 3 Answers
Problems with joystick / controller axes being 1/-1 "way too often" 1 Answer