vlow's picture

OpenAL: Listener orientation seems to be ignored

Hello all,

in my program, the listener follows a car. I have the global coordinates of the car, as well as the rotation around the x, y and z axis. I now configured the listener to follow the car at a distance of 5 units (respecting the rotation of the coordinate system). When my car takes a turn, the noise wanders around me, exactly the way it does with the default listener orientation. My orientation seems to be ignored, but if I check AL.GetError(), there is no error, and if I read the listener orientation from AL.GetListener, I get the values I configured. Is there a way to check if my orientation is correct / accepted?

Thank you



Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Frassle's picture

You can use Al.GetListener(ALListenerfv.Orientation, out at, out up) to get the look at and up vectors for the listener, your forward vector is then (at - position). Hopefully that can help with your debugging.

vlow's picture

Thanks Frassle, I already checked that. Strange enough - the values I get from AL.GetListener imply that my listener orientation has been accepted.

I read somewhere that the at- and the up-vector have to be perpendicular. I use double values out of a simulation tool, which are then casted to floats. That way, they are still perpendicular but their perpendicularity might be off by like 1*10^-2. Can that be the problem? Do the values have to be exactly perpendicular, meaning their vector product has to be exactly 0? What happens if the perpendicularity is not satisfied?

Frassle's picture

You'll rarely get perfectly perpendicular vectors due to float precision, that shouldn't be an issue.

A couple of things I can think of:

  1. Are the vectors normalized?
  2. Do you have SourceRelative set to false on the sources?
  3. Can you share the math that sets these values?