ABSTRACT

The audio engine listener is typically placed at the same location and orientation as the camera. This ensures that what you’re seeing and what you’re hearing match up. You’ll use code something like this:

CONTENTS 11.1 3D Listener Basics 197 11.2 The Third-Person Camera System 198 11.3 The Desired Result 199 11.4 Listener in the Camera 200 11.5 Listener in the Player Character’s Head 201 11.6 Listener Partway between Player Character and Camera 202 11.7 The Correct Solution 203 11.8 Exceptions 206 11.9 Obstruction and Positional Calculations 207 11.10 Conclusion 208

This code will work for many games, particularly first-person shooters. It is tried and tested and true, and will give you good results most of the time.