1.2.6 • Published 6 years ago

babylon-navigation-mesh v1.2.6

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

Babylon-navigation-mesh

NPM version

Demo

A toolkit to navigate on a mesh with BABYLON.js. Largely inspired by PatrolJS for ThreeJS.

Babylon-navigation-mesh is a path finder for AI agents. It use the A star and Funnel algorithms to calculate a path on a navigation mesh.

Usage

Add the npm package babylon-navigation-mesh to your project:

npm install babylon-navigation-mesh --save

or clone:

git clone git@github.com:wanadev/babylon-navigation-mesh.git
npm install 
npm run build

then

var Navigation = require("babylon-navigation-mesh");

And create your object and the associated graph:

var navigation = new Navigation();
var scene = engine.scene;

var navmesh = scene.getMeshByName("Navmesh");
var zoneNodes = navigation.buildNodes(navmesh);
navigation.setZoneData('scene', zoneNodes);

To calculate the path :

var zone = navigation.getGroup('scene', agentPosition);
var path = navigation.findPath(agentPosition, dest, 'scene', zone);

And to project a position on the navmesh:

var newPosition = navigation.projectOnNavmesh(this.position, 'scene', navigation.getGroup('level', this.position));

An article is available to create and use a navigation mesh here (french)

Demo

npm.io

1.2.6

6 years ago

1.2.5

6 years ago

1.2.4

7 years ago

1.2.3

7 years ago

1.2.2

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.1.4

7 years ago

1.1.3

8 years ago

1.1.2

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago