The sound is an asset.
I can't get it to work whatever I try. Here's my code :
<a-entity grabbable draggable shadow dynamic-body="shape: Box; mass: 50" sound="src: ./Sons/chute.mp3; on: collide" class="colis" mixin="colis1" position="1 0.05 -2.5"></a-entity>
I wrote a component to test if collisions are detected :
AFRAME.registerComponent('collision_detection', { init: function() { var sound_fx = document.getElementById('chute'); this.el.addEventListener('collide', function (e) { sound_fx.play();}) } });
If the component is attached to my object, it plays the sound (endlessly), proving the collision is indeed detected.
Any help would be greatly appreciated. Thank you.
Stephan
Hello, I'm trying to play a sound on collision as specified here : []https://github.com/donmccurdy/aframe-extras/issues/48
The sound is an asset. I can't get it to work whatever I try. Here's my code :
<a-entity grabbable draggable shadow dynamic-body="shape: Box; mass: 50" sound="src: ./Sons/chute.mp3; on: collide" class="colis" mixin="colis1" position="1 0.05 -2.5"></a-entity>
I wrote a component to test if collisions are detected :
AFRAME.registerComponent('collision_detection', { init: function() { var sound_fx = document.getElementById('chute'); this.el.addEventListener('collide', function (e) { sound_fx.play();}) } });
If the component is attached to my object, it plays the sound (endlessly), proving the collision is indeed detected.
Any help would be greatly appreciated. Thank you. Stephan