Touch based rotation goes wrong after some rotation applied to model
Basically I want to rotate my 3d model using horizontal and vertical touches. For this I have written something like this type of code. But I want to restrict z rotation of 3d model so applied different code for it.
Vector2 touchPosition = touch.deltaPosition;
currentAngle.y += rotationSpeed.x touchPosition.x Time.deltaTime;
currentAngle.x += rotationSpeed.y touchPosition.y Time.deltaTime;
currentAngle.z += rotationSpeed.z * Time.deltaTime;
transform.eulerAngles = currentAngle;
After applying this code, if I rotate my model 180 degree in y rotation then horizontal and vertical swipe control start working in reverse direction. If I swipe left side then model rotated over right side.
If model is rotated around 90 degree in y rotation then behaviour got changed in half way. I hope now you understand what I am trying to say.
I want functionality like, if I swipe in left direction then model gets rotated in left direction, if I swipe in right direction then model gets rotated in right direction whatever the current rotation of model. But want to restrict z rotation that is for most condition but that I have already restricted in above code.