Please assume:

Minimum distance for 3D volume = 1.0;
Maximum distance for 3D volume = 100.0;

This is the declaration of the function:

An object can be a ball moving closer to the player.

void CalculateSoundVolume(Vec3 objectPosition, 
                          Vec3 objectVelocity, 
                          Vec3 userHead, 
                          Vec3 userFoward, 
                          float& leftEarVolume, 
                          float& rightEarVolume)  

  • \$\begingroup\$ I know that I can linearly or logarithmically lower the volume based on the player's position relative to the object. With that lowered volume in hand, how would I calculate the amount of lowered volume to be applied to the right ear and left ear? \$\endgroup\$ Jul 30, 2017 at 7:50
  • \$\begingroup\$ I'm voting to close this question as off-topic because it is a cross-post. \$\endgroup\$
    – user1430
    Jul 30, 2017 at 15:02
  • \$\begingroup\$ It's better to vote for the question in stack overflow rather than in game dev I believe. \$\endgroup\$ Jul 30, 2017 at 19:45


Browse other questions tagged .