From ec50c41044378284b122f871d1868a0b8cf6188f Mon Sep 17 00:00:00 2001 From: Kelsi Date: Wed, 6 May 2026 01:28:46 -0700 Subject: [PATCH] fix(sql): convert NPC orientation from degrees to radians for AzerothCore The editor's orientation field is stored in degrees (matches the UI slider and the M2 renderer's glm::radians() call), but AzerothCore's creature. orientation column expects radians. Without conversion every exported NPC faces the wrong direction in-game (off by 57x). --- tools/editor/sql_exporter.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/editor/sql_exporter.cpp b/tools/editor/sql_exporter.cpp index 59069ecc..b7ef1c6c 100644 --- a/tools/editor/sql_exporter.cpp +++ b/tools/editor/sql_exporter.cpp @@ -88,12 +88,14 @@ bool SQLExporter::exportCreatures(const std::vector& spawns, if (s.behavior == CreatureBehavior::Wander) movementType = 1; if (s.behavior == CreatureBehavior::Patrol) movementType = 2; + // AzerothCore expects orientation in radians; editor stores degrees. + const float orientRad = s.orientation * 3.14159265358979323846f / 180.0f; f << "INSERT INTO `creature` " << "(`guid`, `id`, `map`, `position_x`, `position_y`, `position_z`, " << "`orientation`, `spawntimesecs`, `wander_distance`, `MovementType`) VALUES (" << guid << ", " << entry << ", " << mapId << ", " << s.position.x << ", " << s.position.y << ", " << s.position.z << ", " - << s.orientation << ", " + << orientRad << ", " << (s.respawnTimeMs / 1000) << ", " << s.wanderRadius << ", " << static_cast(movementType)