diff --git a/package-lock.json b/package-lock.json index 41232be..79b8438 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5871,7 +5871,8 @@ }, "ansi-regex": { "version": "2.1.1", - "bundled": true + "bundled": true, + "optional": true }, "aproba": { "version": "1.2.0", @@ -6236,7 +6237,8 @@ }, "safe-buffer": { "version": "5.1.1", - "bundled": true + "bundled": true, + "optional": true }, "safer-buffer": { "version": "2.1.2", @@ -6284,6 +6286,7 @@ "strip-ansi": { "version": "3.0.1", "bundled": true, + "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -6322,11 +6325,13 @@ }, "wrappy": { "version": "1.0.2", - "bundled": true + "bundled": true, + "optional": true }, "yallist": { "version": "3.0.2", - "bundled": true + "bundled": true, + "optional": true } } }, diff --git a/src/components/beat.js b/src/components/beat.js index 06d6486..106d2d1 100644 --- a/src/components/beat.js +++ b/src/components/beat.js @@ -121,14 +121,18 @@ AFRAME.registerComponent('beat', { } else { // Only check collisions when close. const collisionZThreshold = -4; + if (position.z > collisionZThreshold) { this.checkCollisions(); } // Move. if (position.z < this.startPositionZ) { + let newPositionZ = position.z + BEAT_WARMUP_SPEED * (timeDelta / 1000); // Warm up / warp in. - position.z += BEAT_WARMUP_SPEED * (timeDelta / 1000); - if (position.z >= this.startPositionZ) { + if (newPositionZ < this.startPositionZ) { this.beams.newBeam(this.data.color, position); + position.z = newPositionZ; + } else { + position.z = this.startPositionZ; } } else { // Standard moving.