I have an isometric camera for an RTS that looks like this:
Basically, I don't know how to set the listener's position in OpenAL because I represent the camera's position with only two coordinates.
I build my projection matrix as a standard orthographic projection:
projectionMatrix = new Matrix4f() .setOrtho(-25, 25, -25 / aspect, 25 / aspect, -300, 300);
and my view matrix like so:
viewMatrix.identity() .rotate(-rotation.x / 180.0f * Util.PI, 1, 0, 0) .rotate(-225.0f / 180.0f * Util.PI, 0, 1, 0) .rotate(-rotation.z / 180.0f * Util.PI, 0, 0, 1) .scale(zoom) .translate(-position.x, 0, -position.y);
rotation is a 3D vector of the Euler angles, and
position is a 2D vector controlled by the keyboard or dragging the mouse. (
rotation.y is ignored)
How would I translate this 2D position into the 3 coordinates required for OpenAL? I tried to give a y-offset like:
alListener3f(AL_POSITION, position.x, 20, position.z);, but it gave really weird attenuation results.
(PS: I'm using Java, LWJGL, and JOML for math)