I have a math problem can anyone help me?
#4

My mistake, it was Angle2D()
pawn Код:
Float:Angle2D(Float:PointA[], Float:PointB[]) // Credits to 0rb - http://forum.sa-mp.com/index.php?topic=6...#msg582490]http://forum.sa-mp.com/index.php?topic=61574.msg582490#msg582490
{
  new
    Float:Dist[2],
    Float:Angle
  ;

  Dist[0] = PointA[0] < PointB[0] ? PointB[0] - PointA[0] : PointA[0] - PointB[0];
  Dist[1] = PointA[1] < PointB[1] ? PointB[1] - PointA[1] : PointA[1] - PointB[1];

  Angle = atan2(Dist[1], Dist[0]);
  Angle = PointA[0] < PointB[0] ? 270.0 + Angle : 90.0 - Angle;
  Angle = PointA[1] < PointB[1] ? Angle : 180.0 - Angle;
 
  return Angle < 0.0 ? Angle + 360.0 : Angle;
}
That should do the job perfectly

EDIT: Ergh, it appears to have added in the url tags for me, when I didn't want it to, perhaps that's a new function of the forum formatting.

~Cueball~
Reply


Messages In This Thread
I have a math problem can anyone help me? - by rensfromrpas - 03.05.2009, 10:34
Re: I have a math problem can anyone help me? - by Cueball - 03.05.2009, 10:49
Re: I have a math problem can anyone help me? - by rensfromrpas - 03.05.2009, 10:55
Re: I have a math problem can anyone help me? - by Cueball - 03.05.2009, 11:05
Re: I have a math problem can anyone help me? - by rensfromrpas - 03.05.2009, 13:08
Re: I have a math problem can anyone help me? - by Cueball - 04.05.2009, 10:13
Re: I have a math problem can anyone help me? - by yom - 04.05.2009, 10:50

Forum Jump:


Users browsing this thread: 1 Guest(s)