When changing camera listener is updated. Also fixed some crashes in RenderSystem when there were no cameras available.

This commit is contained in:
stiffly
2016-01-15 13:45:08 +01:00
parent 3e2cb33bc0
commit d9dd7f535f
2 changed files with 21 additions and 5 deletions
+6 -1
View File
@@ -135,6 +135,7 @@ void SoundSystem::updateEmitters()
void SoundSystem::updateListener()
{
int testremove = 0;
// Should only be one listener.
auto listenerComponents = m_World->GetComponents("Listener");
if (listenerComponents == nullptr) {
@@ -147,8 +148,12 @@ void SoundSystem::updateListener()
glm::vec3 nextPos = Transform::AbsolutePosition(m_World, listener); // Get next (current) pos
glm::vec3 velocity = nextPos - previousPos; // Calculate velocity
setListenerPos(nextPos);
setListenerVel(velocity);
//setListenerVel(velocity);
setListenerOri(glm::eulerAngles(Transform::AbsoluteOrientation(m_World, listener)));
testremove++;
}
if (testremove > 1) {
testremove = 0;
}
}