Page 1 of 4

Help Needed in Trigonometry ...

Posted: Thu Feb 10, 2005 1:18 am
by s0rcier
Well codes below is raped from mq2move utils circle command, it's work great while your circling clockwise foward, good for bard kiting, but for my zerker i want to be able to circle backward, facing mobs all the time going anti-clockwise around the circle, and well this functions doesnt do the jobs ... work partially for a while ...

Code: Select all

   double heading; 
   double CircleRadius = 25.0f;
   double X =PcX-CircleX; 
   double Y =PcY-CircleY; 
   double distance=sqrt(X*X + Y*Y); 
   if (distance>(CircleRadius*(2.0/3.0))) { 
      heading=atan2(PcY - CircleY, CircleX - PcX) * 180.0f / PI + 90.0f; 
      heading += 90.0f * (CircleRadius/distance); 
      heading *= 512.0f/360.0f; 
      if( heading >= 512.0f ) heading -= 512.0f; 
      if( heading < 0.0f ) heading += 512.0f; 
   } 
dont know if someone could help or have some solutions, i presume that this circle routine heading was not design at all for what i need at all ... i really wish if someone could help on this finding problems and giving a solutions ... or could at least better explains the problems ... if you want to simulate problems fast use mq2moveutils, /circle on 25 and press down the back keys .... you will find what i means ..

s0rCieR

Original code?

Posted: Thu Feb 10, 2005 1:37 am
by JJ
Is that the original code or your modified code?

Posted: Thu Feb 10, 2005 1:49 am
by s0rcier
Well modified or mines ... 99% identical to mq2moveutils codes ... if you find flaw in mq2move utils you will find flaw in this one too :P

here is the moveutils code :P

Code: Select all

   double X = pChSpawn->X - CircleX; 
   double Y = pChSpawn->Y - CircleY; 
   distance = sqrt(X*X + Y*Y); 

   if (distance>(CircleRadius*(2.0/3.0))) { 
      heading=atan2(pChSpawn->Y - CircleY, CircleX - pChSpawn->X) * 180.0f / PI + 90.0f; 
      heading += 90.0f * (CircleRadius/distance); 
      heading *= 512.0f/360.0f; 
      if( heading >= 512.0f ) heading -= 512.0f; 
      if( heading < 0.0f ) heading += 512.0f; 
      if( bDrunken ) { 
         gFaceAngle = (float)heading; 
      } else { 
         pChSpawn->Heading = (float)heading; 
      } 
   } 
Like i said this works nice if you try to circle clockwise with foward key press ... but dont break when pressing down the back key (and moving backward istead) ...

Posted: Thu Feb 10, 2005 4:18 pm
by InDShadows
If you are looking to basically kite behind a mob meleing then trying to get your timers rights between the two comps will be a huge pain, may i suggest that you just modify follow.mac to suit your needs, distance paramateres is pretty obvious. Its a very simple loop, so adding /doabilities and /attack on is extreemely simple.

Posted: Thu Feb 10, 2005 5:33 pm
by dont_know_at_all
I'm not sure what you are asking. You can't face the mob, run backwards, and circle at the same time.

Posted: Fri Feb 11, 2005 12:54 am
by Night Hawk
Well if your running backwards, in a circle motion, your kind of already facing the mob.... right?

"Anti-clockwise" that made me laugh ;)

Posted: Fri Feb 11, 2005 3:33 am
by dont_know_at_all
"kind of" is not really very trigonometrical.

Posted: Fri Feb 11, 2005 6:27 am
by TheUnholy
Can you say "Anti-clockwise" and "Trigonometry" in the same post? I think that defies certain laws.

Posted: Fri Feb 11, 2005 6:51 am
by aChallenged1
Only if you apply the Cowbell to it properly. :P

Posted: Sat Feb 12, 2005 1:51 am
by s0rcier
Well just try with mq2move utils, start a 50 radius circle and hold down the foward key ... you will circle foward ... stop and hit down the back key and you will see that you actually circling for a while but at a point it break up ... pretty sure it's just something easy ... just that i can't point it out atm ...

Well thx for your cooperation, and sorry i didnt spill it right correctly ;P

s0rCieR

Posted: Sat Feb 12, 2005 4:00 am
by dont_know_at_all
change

Code: Select all

 heading += 90.0f * (CircleRadius/distance);
to

Code: Select all

 heading += 90.0f * (distance/CircleRadius);

Posted: Tue Feb 15, 2005 3:28 am
by s0rcier
Well i give up :P will just hard code my circle at my prefered kyte spot :P rofl ... thx guys

s0rCieR

Posted: Tue Feb 15, 2005 1:14 pm
by MrSmallie
If you're trying to circle kite a mob to throw ranged attacks at him...good luck...whether clockwise, or counter, forward or back.

If you're going to hardcode something for your prefered location, I suggest a double parallelogram pattern if yuo're the one with agro. If you don't have agro, just use the follow.mac.

Re: Help Needed in Trigonometry ...

Posted: Wed Apr 09, 2025 11:35 am
by xyilla

Re: Help Needed in Trigonometry ...

Posted: Wed Apr 09, 2025 11:37 am
by xyilla