This quick chapter demonstrates that using sounds (2D and 3D) in a 3D engine can be easy when powerful tools are provided to the developer. The example files create a 2D sound that is played as a soundtrack and a 3D sound located at the box's position. Do not hesitate to play with the distance models and check the effects using your headphones.
In the next chapter, we'll try to automate some things using the ActionManager
class of Babylon.js. This class is useful for executing actions on objects when a trigger is raised. For example, if the player left-clicks on the box, it plays the sound named my_sound.wav
. It's also the time to introduce
Actions Builder, which is a part of the Babylon.js 3ds Max exporter. Actions Builder allows artists (and developers) to create actions on their objects without any lines of code.