Hi, i need to add rotation clamp in the current code.
private Touch touch;
private Vector2 touchposition;
private Quaternion rotationx, rotationz;
private float tiltspeedmodifier = 0.1f;
void Update(){
if(Input.touchCount>0)
{
touch = Input.GetTouch(0);
switch(touch.phase){
case TouchPhase.Moved:
rotationx=Quaternion.Euler(
-touch.deltaPosition.x * tiltspeedmodifier,0f,0f);
transform.rotation= rotationx * transform.rotation;
rotationz= Quaternion.Euler(
0f,0f, - touch.deltaPosition.y * tiltspeedmodifier);
transform.rotation= transform.rotation * rotationz;
break;
}
}
}