I am implementing a weapon wheel in Unity and I have most of it all worked out, but am struggling with one issue:
My weapon wheel looks a bit like this one (example only):
And mine is for something else, not weapons.. but that doesn't matter.
There is no mouse involved.. the idea is to spin the wheel left and right until you've selected the item you want.. the selected one would be the one in the top most position (the example above is the bottom most position, it seems).. Anyway, I have it moving left and right just fine.. the problem now is trying to figure out which button (yes, they are implemented as UI buttons) is currently in the selected position.
My initial thoughts are
To calculate the center X, Y pair of the "selected" location and store those..
When user hits action button to select, then iterate through the 8 buttons I have in that weapon wheel and..
Calculate the current X and Y of each button in the loop
If the button overlaps the "selected" location, then invoke that button's click()
This is proving to be a real pain in the neck though.. for example, I have found that the button transform's positon is always 0,0 until you show the UI at least once.. so I have to use Update() instead of Start().. In addition, trying to calculate the overlap means needing to add width of button to current X and height to current Y and getting pixel width does not seem to be an easy task.
Is there some simpler way to do this? How can I have a "selected" button on my weapon wheel without too much fuss like this? And if this really is the only way, then please let me know how I can get the pixel width and height of buttons.