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.
This commit is contained in:
Kelsi 2026-03-24 10:17:47 -07:00
parent c09a443b18
commit d44411c304

View file

@ -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);