Guard to prevent warm-up animation from overshooting start position when dropping frames
This commit is contained in:
13
package-lock.json
generated
13
package-lock.json
generated
@@ -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
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user