diff --git a/src/components/audio-feedback.js b/src/components/audio-feedback.js index fda5838d8322be59b9ddd3494f3fa189dee8d077..aa7182fa7329145078a1ff27270700164444efff 100644 --- a/src/components/audio-feedback.js +++ b/src/components/audio-feedback.js @@ -34,11 +34,9 @@ AFRAME.registerComponent("networked-audio-analyser", { */ AFRAME.registerComponent("matcolor-audio-feedback", { tick() { - if (!this.mat) return; - const audioAnalyser = this.el.components["networked-audio-analyser"]; - if (!audioAnalyser) return; + if (!audioAnalyser || !this.mat) return; this.object3D.mesh.color.setScalar(1 + audioAnalyser.volume / 255 * 2); } diff --git a/src/components/character-controller.js b/src/components/character-controller.js index e3b49a7cfaf9fb3446c91a368b8926694a630ad3..f32debe666107ccfb6144f94e7ca5afe3f9f4168 100644 --- a/src/components/character-controller.js +++ b/src/components/character-controller.js @@ -140,8 +140,10 @@ AFRAME.registerComponent("character-controller", { root.matrix.premultiply(pivotRotationMatrix); // Reapply playspace (player rig) rotation root.matrix.premultiply(rotationMatrix); - // Reapply playspace (player rig) translation and update pos/rot/scale - root.applyMatrix(trans); + // Reapply playspace (player rig) translation + root.matrix.premultiply(trans); + // update pos/rot/scale + root.matrix.decompose(root.position, root.quaternion, root.scale); // TODO: the above matrix trnsfomraitons introduce some floating point errors in scale, this reverts them to // avoid spamming network with fake scale updates