mikethebike

06-19-2010, 01:48 AM

Hi

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?

Many thanks

Michael

openal listener using this float value:

sim/graphics/view/view_x

etc.

aircraft sound positions use those float values:

sim/flightmodel/position/local_x

lX = local_x etc.

SourcesPos[1][0] = (lX/100)-pTheta;//pitch

SourcesPos[1][1] = (lY/100)+(heading/100);

SourcesPos[1][2] = (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 (-pitch,-1.0,0.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.

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?

Many thanks

Michael

openal listener using this float value:

sim/graphics/view/view_x

etc.

aircraft sound positions use those float values:

sim/flightmodel/position/local_x

lX = local_x etc.

SourcesPos[1][0] = (lX/100)-pTheta;//pitch

SourcesPos[1][1] = (lY/100)+(heading/100);

SourcesPos[1][2] = (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 (-pitch,-1.0,0.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.