From d44411c304ee56269e6233f9cb12476c28326e76 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Tue, 24 Mar 2026 10:17:47 -0700 Subject: [PATCH] fix: convert PLAY_OBJECT_SOUND positions to render coords for 3D audio Entity positions are in canonical WoW coords (X=north, Y=west) but the audio listener uses render coords (X=west, Y=north) from the camera. Without conversion, distance attenuation was computed on swapped axes, making NPC ambient sounds (peasant voices, etc.) play at wrong volumes regardless of actual distance. --- src/core/application.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/application.cpp b/src/core/application.cpp index 0599ba42..73ea9cb4 100644 --- a/src/core/application.cpp +++ b/src/core/application.cpp @@ -2921,10 +2921,12 @@ void Application::setupUICallbacks() { if (name.empty()) continue; std::string path = dir.empty() ? name : dir + "\\" + name; - // Play as 3D sound if source entity position is available + // Play as 3D sound if source entity position is available. + // Entity stores canonical coords; listener uses render coords (camera). auto entity = gameHandler->getEntityManager().getEntity(sourceGuid); if (entity) { - glm::vec3 pos{entity->getLatestX(), entity->getLatestY(), entity->getLatestZ()}; + glm::vec3 canonical{entity->getLatestX(), entity->getLatestY(), entity->getLatestZ()}; + glm::vec3 pos = core::coords::canonicalToRender(canonical); audio::AudioEngine::instance().playSound3D(path, pos); } else { audio::AudioEngine::instance().playSound2D(path);