small fixes and clean ups

This commit is contained in:
Diego F. Goberna
2018-11-14 21:58:47 +01:00
parent 72feb92923
commit 109e55ecff
3 changed files with 12 additions and 11 deletions

View File

@@ -16,7 +16,7 @@ AFRAME.registerComponent('gpu-preloader', {
this.preloadMissMap();
this.preloadPlayButton();
this.preloadSearchPrevPage();
//this.preloadWallMap();
this.preloadWallMap();
this.preloadWrongMap();
this.preloadGenres();
}, 1000);

View File

@@ -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; }
}
}
}

View File

@@ -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"></a-entity>
<a-entity
id="sparkParticles"
particleplayer="src: #sparksJSON; color: #fcc; pscale: 0.7; on: start; scale: 0.3; loop: false; img: #spark2Img; dur: 700; count: 50%; animateScale: true; initialScale: 3 0.5 1; finalScale: 0.1 0.5 1"></a-entity>
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"></a-entity>
<!-- Player. -->