Sound fx on collision not working
StephanRodriguez opened this issue · 1 comments
Hello,
I'm trying to play a sound on collision as specified here :
[]c-frame/aframe-extras#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
Can you share a full demo? It seems like if the event is firing as expected, the problem is probably not in aframe-physics-system.