Skip to content

Commit

Permalink
Fix pathfinding on scene change
Browse files Browse the repository at this point in the history
  • Loading branch information
brianpeiris committed Jan 23, 2019
1 parent 5368136 commit dab5812
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/components/character-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ AFRAME.registerComponent("character-controller", {
this.snapRotateRight = this.snapRotateRight.bind(this);
this.setAngularVelocity = this.setAngularVelocity.bind(this);
this.handleTeleport = this.handleTeleport.bind(this);
this.el.sceneEl.addEventListener("nav-mesh-loaded", () => {
this.navGroup = null;
this.navNode = null;
});
},

update: function() {
Expand Down
1 change: 1 addition & 0 deletions src/systems/nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ AFRAME.registerSystem("nav", {
const geometry = new THREE.Geometry().fromBufferGeometry(mesh.geometry);
geometry.applyMatrix(mesh.matrixWorld);
this.pathfinder.setZoneData(zone, Pathfinding.createZone(geometry));
this.el.sceneEl.emit("nav-mesh-loaded");
}
});

0 comments on commit dab5812

Please sign in to comment.