How to attach an audio to a mesh?

Hey everyone, Im currently doing a project with Babylonjs and would like to know how to attach a sound to a mesh, so that when the player/user grabs that object sound starts to play. Its a Webxr project. Sorry if its a silly question but Im new to this platform.

here we are: Audio | Babylon.js Documentation (

1 Like

But I have done this much, sorry I think I didn’t structure my question in a proper way, actually my project is vr based so I want the audio to start playing only when the user grabs that object, right now the audio starts as soon as the scene is loaded.

As an overview, you would want an event listener on the object, which is triggered when the user grabs the object. Depending on what your code looks like, I’m guessing that is a controller pointer event, or some sort or ray hitting the mesh and intersecting with it.

The handler / callback for this event listener would be the BABYLON.Sound object’s play() method.
The documentation has a playground here that shows the code (in a non-WebXr sense) to do this… weirdly it doesnt actually play sound for me on the mouse click, but works on the space down event)

Thank you @Chrisor9.

1 Like