How to use the navmesh/src function in navmesh

To help you get started, we’ve selected a few navmesh 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 mikewesthad / navmesh / packages / phaser-navmesh / src / navmesh-plugin.js View on Github external
const polygons = objects.map(obj => {
      const top = obj.y;
      const bottom = obj.y + obj.height;
      const left = obj.x;
      const right = obj.x + obj.width;
      return [
        { x: left, y: top },
        { x: left, y: bottom },
        { x: right, y: bottom },
        { x: right, y: top }
      ];
      // return new Phaser.Geom.Polygon([[left, top], [left, bottom], [right, bottom], [right, top]]);
    });

    // Build the navmesh
    const mesh = new NavMesh(polygons, meshShrinkAmount);
    this.navMeshes.push(mesh);
    return mesh;
  }
github mikewesthad / navmesh / packages / phaser-navmesh / src / phaser-navmesh.js View on Github external
constructor(plugin, key, meshPolygonPoints, meshShrinkAmount = 0) {
    this.key = key;
    this.plugin = plugin;
    this.scene = plugin.scene;
    this.debugGraphics = null;
    this.navMesh = new NavMesh(meshPolygonPoints, meshShrinkAmount);
  }
github mikewesthad / navmesh / packages / phaser2-navmesh / src / phaser2-navmesh.js View on Github external
constructor(plugin, key, meshPolygonPoints, meshShrinkAmount = 0) {
    this.key = key;
    this.plugin = plugin;
    this.game = plugin.game;
    this.debugGraphics = null;
    this.navMesh = new NavMesh(meshPolygonPoints, meshShrinkAmount);
  }

navmesh

A library for fast pathfinding using navigation meshes in JS

MIT
Latest version published 3 years ago

Package Health Score

45 / 100
Full package analysis

Popular navmesh functions