Playing 3D sounds

In the previous topic, you added and played 2D sounds in a scene. These 2D sounds can be easily used as soundtracks for your games. To add dynamism to your scenes, as physics and collisions do, you can configure the sounds to be spatialized in a scene. The spatialized sounds, which are called 3D sounds, give give the notion of distance and orientation between the player and the sound. In other words, more the player is far from the sound, more the sound will be attenuated. Also, if the sound position is rather on the right of the player, the right speaker will generate more sound than the left speaker and vice versa.

For example, if the sound is emitted on your right, only the right speaker(s) should play it and the farther you ...

Get Babylon.js Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.