mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-11 07:38:36 +00:00
Fix issue with heading being incorrectly handled
So we've been doing heading wrong all these years. You will need to run a script to fix your quests and required SQL to fix DB. This fixes a ton of random issues with headings and as gives us a better resolution on headings :P
This commit is contained in:
@@ -435,27 +435,6 @@ float Mob::CalculateDistance(float x, float y, float z) {
|
||||
return (float)sqrtf(((m_Position.x - x)*(m_Position.x - x)) + ((m_Position.y - y)*(m_Position.y - y)) + ((m_Position.z - z)*(m_Position.z - z)));
|
||||
}
|
||||
|
||||
float Mob::CalculateHeadingToTarget(float in_x, float in_y) {
|
||||
float angle;
|
||||
|
||||
if (in_x - m_Position.x > 0)
|
||||
angle = -90 + atan((float)(in_y - m_Position.y) / (float)(in_x - m_Position.x)) * 180 / M_PI;
|
||||
else if (in_x - m_Position.x < 0)
|
||||
angle = +90 + atan((float)(in_y - m_Position.y) / (float)(in_x - m_Position.x)) * 180 / M_PI;
|
||||
else // Added?
|
||||
{
|
||||
if (in_y - m_Position.y > 0)
|
||||
angle = 0;
|
||||
else
|
||||
angle = 180;
|
||||
}
|
||||
if (angle < 0)
|
||||
angle += 360;
|
||||
if (angle > 360)
|
||||
angle -= 360;
|
||||
return (256 * (360 - angle) / 360.0f);
|
||||
}
|
||||
|
||||
bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, int speed, bool checkZ, bool calcHeading) {
|
||||
if (GetID() == 0)
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user