mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 11:28:03 +02:00
project source position onto XZ plane of listener
This commit is contained in:
parent
bfad6c8f61
commit
4b208e1678
1 changed files with 6 additions and 0 deletions
|
@ -196,6 +196,11 @@ int main(int argc, const char* argv[]) {
|
||||||
// not performed if listener is inside spherical injector
|
// not performed if listener is inside spherical injector
|
||||||
|
|
||||||
// calculate the angle from the source to the listener
|
// 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),
|
bearingRelativeAngleToSource = glm::orientedAngle(glm::vec3(0.0f, 0.0f, -1.0f),
|
||||||
glm::normalize(rotatedSourcePosition),
|
glm::normalize(rotatedSourcePosition),
|
||||||
glm::vec3(0.0f, 1.0f, 0.0f));
|
glm::vec3(0.0f, 1.0f, 0.0f));
|
||||||
|
@ -203,6 +208,7 @@ int main(int argc, const char* argv[]) {
|
||||||
// calculate the angle delivery
|
// calculate the angle delivery
|
||||||
glm::vec3 rotatedListenerPosition = glm::inverse(otherAgentBuffer->getOrientation())
|
glm::vec3 rotatedListenerPosition = glm::inverse(otherAgentBuffer->getOrientation())
|
||||||
* relativePosition;
|
* relativePosition;
|
||||||
|
|
||||||
float angleOfDelivery = glm::angle(glm::vec3(0.0f, 0.0f, 1.0f),
|
float angleOfDelivery = glm::angle(glm::vec3(0.0f, 0.0f, 1.0f),
|
||||||
glm::normalize(rotatedListenerPosition));
|
glm::normalize(rotatedListenerPosition));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue