Ejemplo n.º 1
0
    IEnumerator Rotation(ViveController.SwipeDirection dir)
    {
        float angleDir = 0.0f;

        switch (dir)
        {
        case ViveController.SwipeDirection.LEFT:
            angleDir = 1.0f;
            break;

        case ViveController.SwipeDirection.RIGHT:
            angleDir = -1.0f;
            break;
        }
        //Debug.Log("dir="+ dir+" angle="+angle);

        float angle = 0.0f;

        while (angle < 90.0f)
        {
            float deltaAngle = 90 * Time.deltaTime * (1 / second);
            target.transform.Rotate(new Vector3(0, 0, angleDir * deltaAngle));
            angle += deltaAngle;
            yield return(null);
        }
        isRotate = false;
        yield return(null);
    }
Ejemplo n.º 2
0
 void OnSwipe(ViveController.SwipeDirection dir)
 {
     if (isRotate == false)
     {
         isRotate = true;
         StartCoroutine(Rotation(dir));
     }
 }