Double check of math for /face

A forum for feature requests/discussions and user submitted patches that improve MQ2

Moderator: MacroQuest Developers

wassup
Official Guardian and Writer of TFM
Official Guardian and Writer of TFM
Posts: 1487
Joined: Sat Oct 26, 2002 5:15 pm

Post by wassup » Sat Oct 25, 2003 1:03 pm

Not sure what difference this makes, but something seems a bit off to me:

Code: Select all

gFaceAngle = (atan2(pSpawnClosest->X - pChar->X, pChar->Y - pSpawnClosest->Y) * 256.0f / PI);
In all trig problems I have ever done, you need to remain consistent when finding the difference between the x's and y's, which makes me wonder why the above shouldn't be:

Code: Select all

gFaceAngle = (atan2(pSpawnClosest->X - pChar->X, pSpawnClosest->Y - pChar->Y) * 256.0f / PI);
Might be something you are doing that I don't understand due to the EQ coordinate system, but this just seemed strange to me since signs are important in trig.

Lax
We're not worthy!
We're not worthy!
Posts: 3524
Joined: Thu Oct 17, 2002 1:01 pm
Location: ISBoxer
Contact:

Post by Lax » Sat Oct 25, 2003 1:51 pm

I explained that EQ is backwards when it comes to east/west, but it turns out that doesnt matter for this equation anyway. In my testing /face person works as is..
Lax Lacks
Master of MQ2 Disaster
Purveyor of premium, EULA-safe MMORPG Multiboxing Software
* Multiboxing with ISBoxer: Quick Start Video
* EQPlayNice, WinEQ 2.0

wassup
Official Guardian and Writer of TFM
Official Guardian and Writer of TFM
Posts: 1487
Joined: Sat Oct 26, 2002 5:15 pm

Post by wassup » Sat Oct 25, 2003 6:54 pm

I must be confused then, or just totally don;t understand why the order isn;t important.

From Microsoft reference:
http://msdn.microsoft.com/library/defau ... .atan2.asp

In particular:
atan2 uses the signs of both parameters to determine the quadrant of the return value.
Since atan2 uses the sign of x and y the order of subtraction would make a difference.

I'm not trying to argue here, just get a better understanding.

Lax
We're not worthy!
We're not worthy!
Posts: 3524
Joined: Thu Oct 17, 2002 1:01 pm
Location: ISBoxer
Contact:

Post by Lax » Sun Oct 26, 2003 6:07 am

Wassup, you are right. The way it is in MQ is the way you say it should be. I suggested swapping the Y subtraction because of the east/west reversal in EQ (see previous post)
Lax Lacks
Master of MQ2 Disaster
Purveyor of premium, EULA-safe MMORPG Multiboxing Software
* Multiboxing with ISBoxer: Quick Start Video
* EQPlayNice, WinEQ 2.0

Mckorr
Developer
Developer
Posts: 2326
Joined: Fri Oct 18, 2002 1:16 pm
Location: Texas

Post by Mckorr » Mon Oct 27, 2003 9:40 am

Swapping the values causes a 90 degree turn away from your target. I've tested all permutations, and the only one that works right is the current version.

Not sure what is causing the strange facing behavior, or why it only occurs at range. Possibly it is the prediction code.
MQ2: Think of it as Evolution in action.