From f579976d9188f467bb27c2c68eb1b596b66fead3 Mon Sep 17 00:00:00 2001 From: Marshall Quander <marshall@quander.me> Date: Wed, 4 Jul 2018 02:29:08 -0700 Subject: [PATCH] Fix buggy check in setPositionOnNavMesh --- src/components/character-controller.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/character-controller.js b/src/components/character-controller.js index f32debe66..02322f1a4 100644 --- a/src/components/character-controller.js +++ b/src/components/character-controller.js @@ -18,8 +18,8 @@ AFRAME.registerComponent("character-controller", { }, init: function() { - this.navGroup; - this.navNode; + this.navGroup = null; + this.navNode = null; this.velocity = new THREE.Vector3(0, 0, 0); this.accelerationInput = new THREE.Vector3(0, 0, 0); this.pendingSnapRotationMatrix = new THREE.Matrix4(); @@ -160,7 +160,7 @@ AFRAME.registerComponent("character-controller", { setPositionOnNavMesh: function(startPosition, endPosition, object3D) { const nav = this.el.sceneEl.systems.nav; if (nav.navMesh) { - if (!this.navGroup) { + if (this.navGroup == null) { this.navGroup = nav.getGroup(endPosition); } this.navNode = this.navNode || nav.getNode(endPosition, this.navGroup); -- GitLab