From 4e71423cd8b737e7772a51a9798356486ba433b6 Mon Sep 17 00:00:00 2001 From: Diego Marcos Date: Fri, 26 Oct 2018 16:09:57 -0700 Subject: [PATCH] Set rotation to initial rotation after warmup animation --- src/components/beat.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/beat.js b/src/components/beat.js index 106d2d1..e14dbb6 100644 --- a/src/components/beat.js +++ b/src/components/beat.js @@ -115,6 +115,7 @@ AFRAME.registerComponent('beat', { tock: function (time, timeDelta) { const el = this.el; const position = el.object3D.position; + const rotation = el.object3D.rotation; if (this.destroyed) { this.tockDestroyed(timeDelta); @@ -137,6 +138,7 @@ AFRAME.registerComponent('beat', { } else { // Standard moving. position.z += this.data.speed * (timeDelta / 1000); + rotation.z = this.startRotationZ; } if (position.z > (this.startPositionZ - BEAT_WARMUP_ROTATION_OFFSET) && @@ -159,6 +161,8 @@ AFRAME.registerComponent('beat', { */ onGenerate: function () { this.startPositionZ = this.el.object3D.position.z; + this.startRotationZ = this.el.object3D.rotation.z; + this.el.object3D.position.z -= BEAT_WARMUP_OFFSET; // Set up rotation warmup.