Skip to content

Commit

Permalink
fix(RadialMenu): apply correct rotation offset to menu
Browse files Browse the repository at this point in the history
The radial menu offset rotation was inverted causing issues when
pressing the touchpad as the touch position was not in the same
location as the button position.

This fix inverts the touch coordinate to ensure it matches the
button position.
  • Loading branch information
thestonefox committed Jan 5, 2017
1 parent 948ba25 commit f11bbc5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Assets/VRTK/Scripts/Controls/2D/RadialMenu/RadialMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ private void InteractButton(float angle, ButtonEvent evt) //Can't pass ExecuteEv
{
//Get button ID from angle
float buttonAngle = 360f / buttons.Count; //Each button is an arc with this angle
angle = mod((angle + offsetRotation), 360); //Offset the touch coordinate with our offset
angle = mod((angle + -offsetRotation), 360); //Offset the touch coordinate with our offset

int buttonID = (int)mod(((angle + (buttonAngle / 2f)) / buttonAngle), buttons.Count); //Convert angle into ButtonID (This is the magic)
var pointer = new PointerEventData(EventSystem.current); //Create a new EventSystem (UI) Event
Expand Down

0 comments on commit f11bbc5

Please sign in to comment.