On 08/23/2015 12:43 AM, Kevin Fishburne wrote: > > Okay, I found this code: > > https://hackage.haskell.org/package/OpenAL-1.4.0.1/docs/src/Sound-OpenAL-AL-Listener.html > > with perhaps this being the pertinent information in its comments: > > -- | 'orientation' contains an \"at\" vector and an \"up\" vector, where the > -- \"at\" vector represents the \"forward\" direction of the listener > and the > -- orthogonal projection of the \"up\" vector into the subspace > perpendicular to > -- the \"at\" vector represents the \"up\" direction for the listener. > OpenAL > -- expects two vectors that are linearly independent. These vectors are not > -- expected to be normalized. If the two vectors are linearly dependent, > -- behavior is undefined. The initial orientation is ('Vector3' 0 0 (-1), > -- 'Vector3' 0 1 0), i.e. looking down the Z axis with the Y axis pointing > -- upwards. > > I changed the listener orientation vector assignment line to this: > > Al.Listenerfv(Al.ORIENTATION, [0, 0, -1, 0, 1, 0]) > > and it seems to work with Al.SOURCE_RELATIVE set to FALSE for both > listener and source position changes. Yummy. Let me know if any of this > sounds correct and I'll continue testing/experimentation. >
I now have OpenAL working well but I need to know how to change the orientation of the coordinate system to reflect that used by my game. Normally in a 3D game the X axis is left/right, the Y axis is up/down/elevation, and the Z axis goes into the screen (in/out). In Sylph the Y axis goes into the screen and the Z axis is up/down/elevation. As you move into the screen the Y coordinates decrease. An easy way to think about it is a piece of graph paper where the upper-left corner is X:0, Y:0 and the bottom-right corner is X:100, Y:100. You start at the bottom, facing the top, and move along the Y axis toward the top. I believe that Al.Listenerfv(Al.ORIENTATION, [0, 0, -1, 0, 1, 0]) orients the audio environment using the traditional axes and not mine where the Z and Y axes are switched. I have no idea how to calculate the proper values for this statement to reflect the axes used in Sylph. Here's another explanation of how the two vectors in Al.Listenerfv work: http://stackoverflow.com/questions/7861306/clarification-on-openal-listener-orientation If the answer is obvious to anyone reading this, please clue me in. -- Kevin Fishburne Eight Virtues www:http://sales.eightvirtues.com e-mail:sa...@eightvirtues.com phone: (770) 853-6271 ------------------------------------------------------------------------------ _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user