From cc1957a698f144c2bb5830d72773e996ff435e7b Mon Sep 17 00:00:00 2001 From: sippeangelo Date: Mon, 1 Jun 2015 23:06:44 +0200 Subject: [PATCH] Sound system fixed to use absolute positions --- Escape-the-Dawn/Systems/SoundSystem.h | 1 + Escape-the-Dawn/Systems/SoundsSystem.cpp | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Escape-the-Dawn/Systems/SoundSystem.h b/Escape-the-Dawn/Systems/SoundSystem.h index 33b51d9..126bb89 100644 --- a/Escape-the-Dawn/Systems/SoundSystem.h +++ b/Escape-the-Dawn/Systems/SoundSystem.h @@ -2,6 +2,7 @@ #define SoundEmitter_h__ #include "System.h" +#include "Systems/TransformSystem.h" #include "Components/Transform.h" #include "Components/SoundEmitter.h" #include diff --git a/Escape-the-Dawn/Systems/SoundsSystem.cpp b/Escape-the-Dawn/Systems/SoundsSystem.cpp index 864bff5..cc68156 100644 --- a/Escape-the-Dawn/Systems/SoundsSystem.cpp +++ b/Escape-the-Dawn/Systems/SoundsSystem.cpp @@ -64,7 +64,8 @@ void Systems::SoundSystem::UpdateEntity(double dt, EntityID entity, EntityID par alSourcef(source, AL_PITCH, soundEmitter->Pitch); alSourcei(source, AL_LOOPING, soundEmitter->Loop); - glm::vec3 emitterPos = transformComponent->Position; + auto transformSystem = m_World->GetSystem("TransformSystem"); + glm::vec3 emitterPos = transformSystem->AbsolutePosition(entity); ALfloat sourcePos[3] = { emitterPos.x, emitterPos.y, -emitterPos.z }; glm::vec3 emitterVel= transformComponent->Velocity;