diff --git a/src/components/beat.js b/src/components/beat.js index b1d46d5..f4d031b 100644 --- a/src/components/beat.js +++ b/src/components/beat.js @@ -213,6 +213,16 @@ AFRAME.registerComponent('beat', { this.destroyed = true; }, + missHit: function (hand) { + var missEl = hand === 'left' ? this.missElLeft : this.missElRight; + if (!missEl) { return; } + missEl.object3D.position.copy(this.el.object3D.position); + missEl.object3D.position.y += 0.2; + missEl.object3D.position.z -= 0.5; + missEl.object3D.visible = true; + missEl.emit('beatmiss', null, false); + }, + destroyBeat: (function () { var parallelPlaneMaterial = new THREE.MeshBasicMaterial({color: '#00008b', side: THREE.DoubleSide}); var planeMaterial = new THREE.MeshBasicMaterial({color: 'grey', side: THREE.DoubleSide}); @@ -395,6 +405,7 @@ AFRAME.registerComponent('beat', { returnToPool: function (force) { if (!this.backToPool && !force) { return; } + if (!this.destroyed) { this.missHit(); } this.el.sceneEl.components[this.poolName].returnEntity(this.el); }, diff --git a/src/index.html b/src/index.html index e3ef752..08fad05 100644 --- a/src/index.html +++ b/src/index.html @@ -90,11 +90,18 @@ + + @@ -117,10 +124,10 @@ - - - - + + + +