From e041ae7ac71ddebde9006f3924a12cb288867dac Mon Sep 17 00:00:00 2001 From: Kelsi Date: Wed, 6 May 2026 02:49:02 -0700 Subject: [PATCH] fix(sql): convert editor yaw (from +renderX/west) to WoW yaw (from +X/north) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Editor's orientation is measured from +renderX (which maps to west in WoW canonical), but AzerothCore creature.orientation is the WoW yaw measured from +X (north). Without conversion an editor 0deg NPC ended up facing west in-game, off by 90deg even after the radians fix. Now applies `wowYaw = π/2 - editorYaw` and normalizes to [0, 2π). --- tools/editor/sql_exporter.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tools/editor/sql_exporter.cpp b/tools/editor/sql_exporter.cpp index 071f3a98..c7fcaabe 100644 --- a/tools/editor/sql_exporter.cpp +++ b/tools/editor/sql_exporter.cpp @@ -94,8 +94,14 @@ bool SQLExporter::exportCreatures(const std::vector& spawns, const float wowX = s.position.y; const float wowY = s.position.x; const float wowZ = s.position.z; - // AzerothCore expects orientation in radians; editor stores degrees. - const float orientRad = s.orientation * 3.14159265358979323846f / 180.0f; + // AzerothCore expects orientation in radians from +X (north). Editor's + // orientation is in degrees from +renderX (west). Convert via: + // wowYaw = π/2 - editorYaw + constexpr float kPi = 3.14159265358979323846f; + const float editorYawRad = s.orientation * kPi / 180.0f; + float orientRad = kPi * 0.5f - editorYawRad; + while (orientRad < 0.0f) orientRad += 2.0f * kPi; + while (orientRad >= 2.0f * kPi) orientRad -= 2.0f * kPi; f << "INSERT INTO `creature` " << "(`guid`, `id`, `map`, `position_x`, `position_y`, `position_z`, " << "`orientation`, `spawntimesecs`, `wander_distance`, `MovementType`) VALUES ("