Guest User

Untitled

a guest
Jun 19th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. Vector2 A;
  2. Vector2 B;
  3. A.X = currentMouseState.X;
  4. A.Y = currentMouseState.Y;
  5. B.X = Pg.Position.X;
  6. B.Y = Pg.Position.Y;
  7.  
  8. Vector2 D = A - B;
  9.  
  10. double AB = Math.Sqrt((D.X * D.X) + (D.Y * D.Y));
  11. float angle = (float)(Math.Asin(D.X/AB));
  12.  
  13. angle = -(float)Math.Atan2(D.X, D.Y) + MathHelper.Pi;
  14.  
  15. poi angle si somma alla rotazione
Add Comment
Please, Sign In to add comment