How to use three-pathfinding - 5 common examples

To help you get started, we’ve selected a few three-pathfinding examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github donmccurdy / aframe-extras / src / pathfinding / system.js View on Github external
const { Pathfinding } = require('three-pathfinding');

const pathfinder = new Pathfinding();
const ZONE = 'level';

/**
 * nav
 *
 * Pathfinding system, using PatrolJS.
 */
module.exports = AFRAME.registerSystem('nav', {
  init: function () {
    this.navMesh = null;
    this.agents = new Set();
  },

  /**
   * @param {THREE.Geometry} geometry
   */
github mozilla / hubs / src / systems / nav.js View on Github external
init: function() {
    this.pathfinder = new Pathfinding();
  },
github mozilla / hubs / src / systems / nav.js View on Github external
loadMesh: function(mesh, zone) {
    this.el.object3D.updateMatrixWorld();
    const geometry = new THREE.Geometry().fromBufferGeometry(mesh.geometry);
    geometry.applyMatrix(mesh.matrixWorld);
    this.pathfinder.setZoneData(zone, Pathfinding.createZone(geometry));
  }
});
github donmccurdy / aframe-extras / src / pathfinding / system.js View on Github external
setNavMeshGeometry: function (geometry) {
    this.navMesh = new THREE.Mesh(geometry);
    pathfinder.setZoneData(ZONE, Pathfinding.createZone(geometry));
    Array.from(this.agents).forEach((agent) => agent.updateNavLocation());
  },
github NikolaySuslov / livecodingspace / public / vwf / model / aframe / extras / aframe-extras.pathfinding.js View on Github external
setNavMeshGeometry: function setNavMeshGeometry(geometry) {
    this.navMesh = new THREE.Mesh(geometry);
    pathfinder.setZoneData(ZONE, Path.createZone(geometry));
    Array.from(this.agents).forEach(function (agent) {
      return agent.updateNavLocation();
    });
  },

three-pathfinding

Navigation mesh toolkit for three.js, based on PatrolJS

MIT
Latest version published 7 months ago

Package Health Score

71 / 100
Full package analysis