I am currently trying to implement a wheel shaped menu for an android game. The menu should rotate when the user moves his finger up or down the y axis of his screen.
Swipe up --> rotate counter clockwise
Swipe down --> rotate clockwise
I am able to rotate the menu via touch input, but the problem is the following: Every time the finger touches the display, the rotation is reset.
E.g. You can swipe up, the menu rotates and stays in place. But when you want to swipe up again to rotate even further, the rotation resets and starts over.
I guess the problem is very simple, but I tried a lot of stuff and nothing ever changes.
My code:
class{
// ...
void Update(){
if(Input.touches.Length > 0 && Input.GetTouch(0).phase == TouchPhase.Moved){
transform.rotation *= Quaternion.AngleAxis(Input.GetTouch(0).deltaPosition.y, Vector3.forward);
}
}
}
Thanks in advance!