Home > Blockchain >  Java a way to get from an angle the atan2 value (alpha)?
Java a way to get from an angle the atan2 value (alpha)?

Time:01-04

  double dx = mx - px;
    double dy = my - py;
    double alpha = Math.atan2(dy, dx);
    float angle = (float) Math.toDegrees(alpha);
    angle  = 10;

Now I want to convert the angle to the alpha value (atan2) is there a way how i can do that?

The purpose is that I have a game an want to fire bullets with a variation of the degree like a shotgun.

CodePudding user response:

double newalpha = Math.toRadians(angle);
  •  Tags:  
  • Related