From 4b208e16783bbe079835c7dc54a6d7439e1971e1 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 4 Jun 2013 16:11:11 -0700 Subject: [PATCH] project source position onto XZ plane of listener --- audio-mixer/src/main.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/audio-mixer/src/main.cpp b/audio-mixer/src/main.cpp index 4c1ffab1f0..3c9d60b50f 100644 --- a/audio-mixer/src/main.cpp +++ b/audio-mixer/src/main.cpp @@ -196,6 +196,11 @@ int main(int argc, const char* argv[]) { // not performed if listener is inside spherical injector // calculate the angle from the source to the listener + + // project the rotated source position vector onto the XZ plane + rotatedSourcePosition.y = 0.0f; + + // produce an oriented angle about the y-axis bearingRelativeAngleToSource = glm::orientedAngle(glm::vec3(0.0f, 0.0f, -1.0f), glm::normalize(rotatedSourcePosition), glm::vec3(0.0f, 1.0f, 0.0f)); @@ -203,6 +208,7 @@ int main(int argc, const char* argv[]) { // calculate the angle delivery glm::vec3 rotatedListenerPosition = glm::inverse(otherAgentBuffer->getOrientation()) * relativePosition; + float angleOfDelivery = glm::angle(glm::vec3(0.0f, 0.0f, 1.0f), glm::normalize(rotatedListenerPosition));