From 879ea15d195bf9162cf3e8971d43a24ee8fe26b9 Mon Sep 17 00:00:00 2001 From: joni <johnfshaughnessy@gmail.com> Date: Wed, 25 Apr 2018 10:29:50 -0700 Subject: [PATCH] Don't move the character controller when its velocity is zero. --- src/components/character-controller.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/character-controller.js b/src/components/character-controller.js index e6db4c82b..d294172f5 100644 --- a/src/components/character-controller.js +++ b/src/components/character-controller.js @@ -114,6 +114,9 @@ AFRAME.registerComponent("character-controller", { pivotRotationMatrix.makeRotationAxis(rotationAxis, pivot.rotation.y); pivotRotationInvMatrix.makeRotationAxis(rotationAxis, -pivot.rotation.y); this.updateVelocity(deltaSeconds); + if (this.velocity.x === 0 && this.velocity.y === 0 && this.velocity.z === 0) { + return; + } move.makeTranslation(this.velocity.x * distance, this.velocity.y * distance, this.velocity.z * distance); yawMatrix.makeRotationAxis(rotationAxis, rotationDelta); -- GitLab