From 109e55ecff5f93c02710bf61eedd780e074aa6bb Mon Sep 17 00:00:00 2001 From: "Diego F. Goberna" Date: Wed, 14 Nov 2018 21:58:47 +0100 Subject: [PATCH] small fixes and clean ups --- src/components/gpu-preloader.js | 2 +- src/components/saber-intersection.js | 19 ++++++++++--------- src/index.html | 2 +- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/components/gpu-preloader.js b/src/components/gpu-preloader.js index 82866f7..75e0a12 100644 --- a/src/components/gpu-preloader.js +++ b/src/components/gpu-preloader.js @@ -16,7 +16,7 @@ AFRAME.registerComponent('gpu-preloader', { this.preloadMissMap(); this.preloadPlayButton(); this.preloadSearchPrevPage(); - //this.preloadWallMap(); + this.preloadWallMap(); this.preloadWrongMap(); this.preloadGenres(); }, 1000); diff --git a/src/components/saber-intersection.js b/src/components/saber-intersection.js index 1902ab7..e3c958b 100644 --- a/src/components/saber-intersection.js +++ b/src/components/saber-intersection.js @@ -14,6 +14,7 @@ AFRAME.registerComponent('saber-intersection', { this.intersecting = false; this.saberEnterFunc = this.saberEnter.bind(this); this.saberLeaveFunc = this.saberLeave.bind(this); + this.particlesPosition = {position: null, rotation: null}; }, pause: function () { @@ -36,10 +37,10 @@ AFRAME.registerComponent('saber-intersection', { if (!this.data.active) { return; } const saber = this.saberHit[evt.detail.cursorEl.id]; saber.active = true; - int = saber.raycaster.getIntersection(this.el); - console.log(int); - if (int) { - this.particles.emit('start', {position: int.point, rotation: null}); + var intersection = saber.raycaster.getIntersection(this.el); + if (intersection) { + this.particlesPosition.position = intersection.point; + this.particles.emit('explode', this.particlesPosition, false); } this.intersecting = true; }, @@ -53,14 +54,14 @@ AFRAME.registerComponent('saber-intersection', { tick: function (time, delta) { if (this.data.active && this.intersecting) { - var int; + var intersection; if (this.saberHit.rightHand.active) { - int = this.saberHit.rightHand.raycaster.getIntersection(this.el); - if (int) { this.material.uniforms.hitRight.value = int.point; } + intersection = this.saberHit.rightHand.raycaster.getIntersection(this.el); + if (intersection) { this.material.uniforms.hitRight.value = intersection.point; } } if (this.saberHit.leftHand.active) { - int = this.saberHit.leftHand.raycaster.getIntersection(this.el); - if (int) { this.material.uniforms.hitLeft.value = int.point; } + intersection = this.saberHit.leftHand.raycaster.getIntersection(this.el); + if (intersection) { this.material.uniforms.hitLeft.value = intersection.point; } } } } diff --git a/src/index.html b/src/index.html index 1fcc70d..a70ae2b 100644 --- a/src/index.html +++ b/src/index.html @@ -86,7 +86,7 @@ particleplayer="src: #mineParticlesJSON; pscale: 0.5; scale: 1.4; loop: false; on: explode; img: #sparkImg; count: 20%; animateScale: true; initialScale: 3 1 1; finalScale: 0.2 0.2 1"> + particleplayer="src: #sparksJSON; color: #fcc; pscale: 0.7; on: explode; scale: 0.3; loop: false; img: #spark2Img; dur: 700; count: 50%; animateScale: true; initialScale: 3 0.5 1; finalScale: 0.1 0.5 1">