And every frame I call this function
Code: Select all
void UpdateListener(scene::ICameraSceneNode *camera)
{
core::vector3df cameraPosition, cameraTarget, cameraUp;
cameraPosition = camera->getPosition();
ListenerPos[0] = cameraPosition.X/100;
ListenerPos[1] = cameraPosition.Y/100;
ListenerPos[2] = cameraPosition.Z/100;
cameraTarget = camera->getTarget();
ListenerOri[0] = (cameraTarget.X - cameraPosition.X);
ListenerOri[1] = (cameraTarget.Y - cameraPosition.Y);
ListenerOri[2] = -1 * (cameraTarget.Z - cameraPosition.Z);
cameraUp = camera->getUpVector();
ListenerOri[3] = cameraUp.X;
ListenerOri[4] = cameraUp.Y;
ListenerOri[5] = cameraUp.Z;
alListenerfv(AL_POSITION, ListenerPos);
alListenerfv(AL_VELOCITY, ListenerVel);
alListenerfv(AL_ORIENTATION, ListenerOri);
}
I'm dividing the Irrlicht coordinates by 100, but I should probably change listener's AL_MAX_DISTANCE, AL_REFERENCE_DISTANCE, .... Haven't time to play with it, yet.
