mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-16 01:03:51 +00:00
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:
parent
c09a443b18
commit
d44411c304
1 changed files with 4 additions and 2 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue