Quantcast
Channel: Babylon.js
Viewing all articles
Browse latest Browse all 388

How to play the sound only when the moving mesh?

$
0
0

How to make the appearance of a sound only when the moving mesh. I want to move the mesh only arrows. 

If I write "autoplay:true" the music plays regardless of the movement of the mesh. 

var ms = new BABYLON.Sound("Violons", "sounds/violons11.wav", scene, null, {
     loop: true, autoplay: true
 });
 ms.attachToMesh(box);

If I write "autoplay:false" the music is not playing regardless of the movement of the mesh. 

 

Example:

http://www.babylonjs-playground.com/#7JOOL#9


Viewing all articles
Browse latest Browse all 388

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>