Jump to content

How to play the sound only when the moving mesh?


Alex10
 Share

Recommended Posts

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

Link to comment
Share on other sites

I don't get it. If you need to play a sound only when you're moving the mesh associated to it, set autoplay to false and call the play method when you're moving it and stop or pause method when you're stopping moving it. 

 

autoplay is logically playing the sound automatically. ;-)

 

Did I miss something?

 

David

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...