[Solved]Listener with different camera direction

deadvirus

29-08-2009 19:52:54

Hello,
I have a camera with UNIT_Z direction (instead of the normal NEGATIVE_UNIT_Z). This camera is attached to a node, and the Listener is also attached to this node... The problem is (I think) that the listener is made to work with a camera directed to NEGATIVE_UNIT_Z, because I hear the sounds coming from my rear speakers when the sound is in front of me...

Is there anyway to change this? I've looked and haven't seen one...

stickymango

01-09-2009 09:27:50

Hi there,

Sounds like you are using a left-handed coordinate system? If so:
Coordinate System
OpenAL - like OpenGL - uses a right-handed Cartesian coordinate system (RHS), where in a frontal default view X (thumb) points right, Y (index finger) points up, and Z (middle finger) points towards the viewer/camera. To switch from a left handed coordinate system (LHS) to a right handed coordinate systems, flip the sign on the Z coordinate.

I can tell you there aren't any functions for switching coordinate systems, so you will either have to modify the library to switch the listener's direction around, or you could manually set the listener's orientation by detaching it from its node and manually feeding in its current position/orientation in your idle loop.

It would be trivial to add a flag to the lib to switch the z-coordinate in this case so you'd effectively have you listener moving around your world backwards..

HTH

deadvirus

01-09-2009 11:52:37

Hi there,

Sounds like you are using a left-handed coordinate system? If so:
Coordinate System
OpenAL - like OpenGL - uses a right-handed Cartesian coordinate system (RHS), where in a frontal default view X (thumb) points right, Y (index finger) points up, and Z (middle finger) points towards the viewer/camera. To switch from a left handed coordinate system (LHS) to a right handed coordinate systems, flip the sign on the Z coordinate.

I can tell you there aren't any functions for switching coordinate systems, so you will either have to modify the library to switch the listener's direction around, or you could manually set the listener's orientation by detaching it from its node and manually feeding in its current position/orientation in your idle loop.

It would be trivial to add a flag to the lib to switch the z-coordinate in this case so you'd effectively have you listener moving around your world backwards..

HTH


Hello, thanks you.

I'm setting the positions+orientation manually, since I need to do some extra things when the camera position changes, the listener won't be right where the camera node is... so doing it manually its the easy way :)

Thanks.