Skip to content
Snippets Groups Projects
Commit 879ea15d authored by joni's avatar joni
Browse files

Don't move the character controller when its velocity is zero.

parent d84b9daf
No related branches found
No related tags found
No related merge requests found
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment