Sound system fixed to use absolute positions

This commit is contained in:
2015-06-01 23:06:44 +02:00
parent bdec4e8c97
commit cc1957a698
2 changed files with 3 additions and 1 deletions
+1
View File
@@ -2,6 +2,7 @@
#define SoundEmitter_h__
#include "System.h"
#include "Systems/TransformSystem.h"
#include "Components/Transform.h"
#include "Components/SoundEmitter.h"
#include <AL/al.h>
+2 -1
View File
@@ -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<Systems::TransformSystem>("TransformSystem");
glm::vec3 emitterPos = transformSystem->AbsolutePosition(entity);
ALfloat sourcePos[3] = { emitterPos.x, emitterPos.y, -emitterPos.z };
glm::vec3 emitterVel= transformComponent->Velocity;