From d176ae3989a740224e561dc76178b472429a6def Mon Sep 17 00:00:00 2001 From: johnshaughnessy <johnfshaughnessy@gmail.com> Date: Mon, 29 Oct 2018 13:31:48 -0700 Subject: [PATCH] Don't listen to snap_rotate events --- src/components/character-controller.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/components/character-controller.js b/src/components/character-controller.js index 910123ba8..6edc0b233 100644 --- a/src/components/character-controller.js +++ b/src/components/character-controller.js @@ -45,8 +45,6 @@ AFRAME.registerComponent("character-controller", { const eventSrc = this.el.sceneEl; eventSrc.addEventListener("move", this.setAccelerationInput); eventSrc.addEventListener("rotateY", this.setAngularVelocity); - eventSrc.addEventListener("snap_rotate_left", this.snapRotateLeft); - eventSrc.addEventListener("snap_rotate_right", this.snapRotateRight); eventSrc.addEventListener("teleported", this.handleTeleport); }, @@ -54,8 +52,6 @@ AFRAME.registerComponent("character-controller", { const eventSrc = this.el.sceneEl; eventSrc.removeEventListener("move", this.setAccelerationInput); eventSrc.removeEventListener("rotateY", this.setAngularVelocity); - eventSrc.removeEventListener("snap_rotate_left", this.snapRotateLeft); - eventSrc.removeEventListener("snap_rotate_right", this.snapRotateRight); eventSrc.removeEventListener("teleported", this.handleTeleport); this.reset(); }, @@ -78,10 +74,12 @@ AFRAME.registerComponent("character-controller", { snapRotateLeft: function() { this.pendingSnapRotationMatrix.copy(this.leftRotationMatrix); + this.el.emit("snap_rotate_left"); }, snapRotateRight: function() { this.pendingSnapRotationMatrix.copy(this.rightRotationMatrix); + this.el.emit("snap_rotate_right"); }, handleTeleport: function(event) { -- GitLab