TexeL

Untitled

Jul 6th, 2015
323
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.72 KB | None | 0 0
  1. Vector2 v0 = touchesList0[9].position - touchesList0[0].position;
  2.                         Vector2 v1 = touchesList1[9].position - touchesList1[0].position;
  3.  
  4.                         //float deltaY0 = touchesList0[9].position.y - touchesList0[0].position.y
  5.  
  6.  
  7.  
  8.  
  9.                         if (v0.magnitude > 1 || v1.magnitude > 1)
  10.                         {
  11.                             var angle = Vector2.Angle(v0, v1);
  12.                             var angle2 = GetAngleBetweenTwoVectors(v0, v1);
  13.                             //print(angle);
  14.  
  15.  
  16.                             if (Mathf.Sign(v0.y) == Mathf.Sign(v1.y) && Mathf.Abs(v1.y - v0.y) < 8f)
  17.                             {
  18.  
  19.                                 // Pitch State
  20.  
  21.                                 navState = NavigateState.Pitch;
  22.                                 ArtCameraRelativeControl.inst.InitPitchState();
  23.  
  24.                                 print("angle " + angle2);
  25.                                 print("Abs Delta y" + Mathf.Abs(v1.y - v0.y));
  26.  
  27.                                 print("Dot " + Vector2.Dot(v0.normalized, v1.normalized));
  28.                                 print(navState);
  29.                                 //Debug.LogWarning(navState);
  30.                             }
  31.  
  32.                             if (Mathf.Abs(angle2) < 3.4f  && Vector2.Dot(v0.normalized, v1.normalized) < -0.8f)
  33.                             {
  34.  
  35.  
  36.                                 navState = NavigateState.Zoom;
  37.                                 ArtCameraRelativeControl.inst.InitZoomState();
  38.  
  39.  
  40.                                 print("angle " + angle2);
  41.                                 print("Abs Delta y" + Mathf.Abs(v1.y - v0.y));
  42.  
  43.                                 print("Dot " + Vector2.Dot(v0.normalized, v1.normalized));
  44.                                 print(navState);
  45.  
  46.                             }
  47.  
  48.                             if (Mathf.Abs(angle2) > 3.2f && (Vector2.Dot(v0.normalized, v1.normalized) < -0.8f))
  49.                             {
  50.                                 // Rotate State
  51.                                 navState = NavigateState.RotateMove;
  52.                                 ArtCameraRelativeControl.inst.InitRotateState();
  53.                                 print("angle " + angle2);
  54.                                 print("Abs Delta y" + Mathf.Abs(v1.y - v0.y));
  55.  
  56.                                 print("Dot " + Vector2.Dot(v0.normalized, v1.normalized));
  57.                                 print(navState);
  58.  
  59.                                 //Debug.LogWarning(navState);
  60.                             }
  61.  
  62.  
  63.                         }
Advertisement
Add Comment
Please, Sign In to add comment