Anyone out there good with 3D math? Unfortunately, I am definitely not.
I need a formula to calculate pan, a value between -1 and 1.
-1 is full sound on left speaker
0 is equal sound on both speakers
1 is full sound on right speaker
Given values are:
The source's 3D position
The listener's 3D position
The "look-at" direction (a normal vector)
The "up" direction (also normal)
Any help with this would be greatly appreciated. I know a number of computer languages, so it doesn't matter what language you write in, I am mainly just looking for the math.