Advertisement
StormWingDelta

Vector Issues

Apr 22nd, 2014
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.67 KB | None | 0 0
  1. //before conversion to sfml's vector class and should work anywhere
  2. public static double[] AngleToVector(double degreesangle)
  3. {
  4.     double[] newvector = new double[2];
  5.     newvector[0] = calcXOnlyVector(degreesangle % 360);
  6.     newvector[1] = calcYOnlyVector(degreesangle % 360);
  7.     return newvector;
  8. }
  9.  
  10. public static double calcXOnlyVector(double angle)
  11. {
  12.     return Math.Cos(ToRadians(angle));
  13. }
  14. public static double calcYOnlyVector(double angle)
  15. {
  16.     return Math.Sin(ToRadians(angle));
  17. }
  18.  
  19. //this line of code in the sprite class that is after the conversion to SFML Vector
  20. VectorDirection += (MissingMathFunctions.AngleToVectorSFML(angledirection % 360) * this.Acceleration);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement