I am working on a very basic first person project. Given a sound source's X Y Z coordinates and the camera's X Y Z as well as the angle the camera is facing, I would like to know how these values can be used to adjust the gain of the left and right channels of a sound source as it plays a sound. I have been told this can be done with a primitive technique used in early 3D games from the 90's (which is what I'm aiming for) called binaural panning.
I am struggling to find written tutorials on how this can be achieved so I have been referring to chat gpt but have been getting very inconsistent solutions.
What has been consistent is that it says I would need to find the distance between the sound and the listener which makes sense
Then to use dot product to calculate angle of incidence, which when I tell it to clarify it starts giving inaccurate solutions.
And panning coefficients, which is where I can't find any documentation on whatsoever and am curious if GPT just made that term up.
Would anyone know the most effective way to achieve spatial sound given X Y Z and angle of incidence?