Adding sound to objects & play sound on touch event

Published example
Project page
Example that I followed


  1. I’ve got the left mouse button making a sound, but I was unsuccessful adding EVENT_TOUCHSTART in the playsound.js file. I’m not sure how to make an equivalent of the mouse click for touch events.
  2. Is there a good tutorial to attach sound clicks to specific entities in the scene? I’m trying to make it so I can add specific sounds when I click on specific things, 3D or the 2D menus.

Much appreciated for any advice or help, thank you :pray:

Hello @ahainen!

It would be nice if your code could work. It would save a lot of code. However, I only know the way in the example project below.

I saw you already have a sound component added to your scene but I could not find a entity with a listener component. More information about playing sounds can you find in the link below.

To activate a sound by clicking on a 3D object you can use a raycast from the camera to the click position to detect which object is clicked.

To activate a sound by clicking on a 2D element I would use a button component. Make sure the “use input” option on the button component is enabled. You can use the link below for more information on how to make this work.

I hope these links help you on your way.


Thank you :slight_smile: Much appreciated, I will give these all a shot next :pray:

1 Like