I try to move openal sound positions with an airplane in C++. I saw (below) that I could draw in opengl but i wonder how I could use this for my sound positions?
openal listener using this float value:
aircraft sound positions use those float values:
lX = local_x etc.
SourcesPos = (lX/100)-pTheta;//pitch
SourcesPos = (lY/100)+(heading/100);
SourcesPos = (lZ/100)+pPhi;//roll
A given aircraft in X-Plane can be thought to have its own coordinate system with the same units (meters) as world coordinate systems, but positioned differently:
* The origin is at the default center of gravity for the aircraft. * The X axis points to the right side of the aircraft. * The Y axis points up. * The Z axis points to the tail of the aircraft.
You can draw in aircraft coordinates using these OpenGL transformations:
glTranslatef(local_x, local_y, local_z);
glRotatef (-heading, 0.0,1.0,0.0);
glRotatef (-roll, 0.0,0.0,1.0);
where local_x, local_y, and local_z is the plane’s location in “local” (OpenGL) coordinates, and pitch, heading, and roll are the Euler angles for the plane. Be sure to use glPushMtarix and glPopMatrix to restore the coordinate system.